mirror of
https://gitee.com/ShopeX/OMS
synced 2026-04-07 07:15:33 +08:00
1. 【新增】售后单售后原因类型支持搜索
2. 【新增】手工创建订单折扣可输入正数 3. 【优化】盘点申请单确认 4. 【修复】采购退货单模拟出库失败问题 5. 【新增】订单金额客户实付与结算金额 6. 【优化】仓库发货统计报表物料名称显示 7. 【优化】自有仓储虚拟发货逻辑 8. 【修复】基础物料分类管理问题
This commit is contained in:
@@ -205,7 +205,6 @@ class openapi_data_original_orders
|
||||
{
|
||||
if ($filter['order_bn']) {
|
||||
$order_bn = str_replace(',',',',$filter['order_bn']);
|
||||
unset($filter['order_bn']);
|
||||
$order_bn = str_replace(' ','',$order_bn);
|
||||
$order_bn = explode(',',$order_bn);
|
||||
$sqlstr = 'select order_id from sdb_ome_orders where 1';
|
||||
@@ -219,6 +218,7 @@ class openapi_data_original_orders
|
||||
foreach ($orders as $key => $value) {
|
||||
$filter['order_id'][] = $value['order_id'];
|
||||
}
|
||||
unset($filter['order_bn']);
|
||||
}
|
||||
$couObj = app::get('ome')->model('order_coupon');
|
||||
$countNum = $couObj->count($filter);
|
||||
|
||||
@@ -17,11 +17,6 @@
|
||||
|
||||
class openapi_data_original_po{
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* @param mixed $data 数据
|
||||
* @return mixed 返回值
|
||||
*/
|
||||
public function add($data){
|
||||
$result = array('rsp'=>'succ');
|
||||
|
||||
@@ -65,6 +60,59 @@ class openapi_data_original_po{
|
||||
kernel::single('console_po')->do_check($sdf['po_id']);
|
||||
}
|
||||
|
||||
// 写入属性表
|
||||
if (!empty($data['props']) && $sdf['po_id']) {
|
||||
// 解析props(JSON字符串转数组)
|
||||
$props = json_decode($data['props'], true);
|
||||
if ($props && is_array($props)) {
|
||||
$poPropsModel = app::get('purchase')->model('po_props');
|
||||
foreach ($props as $propsCol => $propsValue) {
|
||||
if (!empty($propsValue)) {
|
||||
$inData = array(
|
||||
'po_id' => $sdf['po_id'],
|
||||
'props_col' => $propsCol,
|
||||
'props_value' => $propsValue,
|
||||
);
|
||||
$poPropsModel->insert($inData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 写入明细属性表
|
||||
if (!empty($data['items']) && is_array($data['items']) && $sdf['po_id']) {
|
||||
$poItemsModel = app::get('purchase')->model('po_items');
|
||||
$poItemsPropsModel = app::get('purchase')->model('po_items_props');
|
||||
|
||||
foreach ($data['items'] as $item) {
|
||||
// 如果item中有props字段,保存到po_items_props表
|
||||
if (isset($item['props']) && !empty($item['props'])) {
|
||||
// 通过po_id和bn查询item_id
|
||||
$itemInfo = $poItemsModel->db_dump(array(
|
||||
'po_id' => $sdf['po_id'],
|
||||
'bn' => $item['bn']
|
||||
), 'item_id');
|
||||
|
||||
if ($itemInfo && $itemInfo['item_id']) {
|
||||
// props可能是JSON字符串或数组
|
||||
$itemProps = is_string($item['props']) ? json_decode($item['props'], true) : $item['props'];
|
||||
|
||||
if ($itemProps && is_array($itemProps)) {
|
||||
foreach ($itemProps as $propsCol => $propsValue) {
|
||||
if (!empty($propsValue)) {
|
||||
$inData = array(
|
||||
'item_id' => $itemInfo['item_id'],
|
||||
'props_col' => $propsCol,
|
||||
'props_value' => $propsValue,
|
||||
);
|
||||
$poItemsPropsModel->insert($inData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$result['rsp'] = 'fail';
|
||||
$result['msg'] = $rs['msg'];
|
||||
@@ -73,13 +121,6 @@ class openapi_data_original_po{
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取List
|
||||
* @param mixed $filter filter
|
||||
* @param mixed $offset offset
|
||||
* @param mixed $limit limit
|
||||
* @return mixed 返回结果
|
||||
*/
|
||||
public function getList($filter,$offset=0,$limit=100){
|
||||
$po_mdl = app::get('purchase')->model('po');
|
||||
$poItems_mdl = app::get('purchase')->model('po_items');
|
||||
@@ -110,6 +151,24 @@ class openapi_data_original_po{
|
||||
|
||||
$result = ['lists' => [], 'count' => $count];
|
||||
|
||||
// 批量查询属性表数据
|
||||
$poIds = array_column($data, 'po_id');
|
||||
$poPropsData = [];
|
||||
if (!empty($poIds)) {
|
||||
$poPropsModel = app::get('purchase')->model('po_props');
|
||||
$poPropsList = $poPropsModel->getList('*', array(
|
||||
'po_id' => $poIds
|
||||
));
|
||||
|
||||
// 按po_id分组
|
||||
foreach ($poPropsList as $prop) {
|
||||
if (!isset($poPropsData[$prop['po_id']])) {
|
||||
$poPropsData[$prop['po_id']] = array();
|
||||
}
|
||||
$poPropsData[$prop['po_id']][$prop['props_col']] = $prop['props_value'];
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($data as $k => $v){
|
||||
$v['po_time'] = date('Y-m-d H:i:s',$v['po_time']);
|
||||
$supplier_row = $supplier_mod->getList('bn,name',array('supplier_id'=>$v['supplier']));
|
||||
@@ -149,18 +208,88 @@ class openapi_data_original_po{
|
||||
}
|
||||
}
|
||||
$v['eo_list'] = $isoList;
|
||||
$itemInfos = $poItems_mdl->getList('bn as product_bn,name as product_name, price,num, in_num, defective_num as bad_num,status', array('po_id'=>$v['po_id']));
|
||||
$itemInfos = $poItems_mdl->getList('item_id,bn as product_bn,name as product_name, price,num, in_num, defective_num as bad_num,status', array('po_id'=>$v['po_id']));
|
||||
$v['po_bn']= $formatFilter->charFilter($v['po_bn']);
|
||||
if(!empty($itemInfos)){
|
||||
foreach ($itemInfos as $itemInfo){
|
||||
// 批量查询明细属性表数据
|
||||
$itemIds = array_column($itemInfos, 'item_id');
|
||||
$poItemsPropsData = [];
|
||||
if (!empty($itemIds)) {
|
||||
$poItemsPropsModel = app::get('purchase')->model('po_items_props');
|
||||
$poItemsPropsList = $poItemsPropsModel->getList('*', array(
|
||||
'item_id' => $itemIds
|
||||
));
|
||||
|
||||
// 按item_id分组
|
||||
foreach ($poItemsPropsList as $prop) {
|
||||
if (!isset($poItemsPropsData[$prop['item_id']])) {
|
||||
$poItemsPropsData[$prop['item_id']] = array();
|
||||
}
|
||||
$poItemsPropsData[$prop['item_id']][$prop['props_col']] = $prop['props_value'];
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($itemInfos as $key => $itemInfo){
|
||||
$itemInfo['product_bn']= $formatFilter->charFilter($itemInfo['product_bn']);
|
||||
$itemInfo['product_name']= $formatFilter->charFilter($itemInfo['product_name']);
|
||||
// 添加明细扩展属性
|
||||
$itemInfo['props'] = isset($poItemsPropsData[$itemInfo['item_id']]) ? $poItemsPropsData[$itemInfo['item_id']] : array();
|
||||
// 移除item_id,不输出
|
||||
unset($itemInfo['item_id']);
|
||||
$itemInfos[$key] = $itemInfo;
|
||||
}
|
||||
$v['items']= $itemInfos;
|
||||
$v['props'] = isset($poPropsData[$v['po_id']]) ? $poPropsData[$v['po_id']] : array();
|
||||
$result['lists'][] =$v;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function cancel($data)
|
||||
{
|
||||
$result = array('rsp' => 'succ');
|
||||
|
||||
$po_mdl = app::get('purchase')->model('po');
|
||||
$formatFilter = kernel::single('openapi_format_abstract');
|
||||
|
||||
// 获取采购单编号
|
||||
$po_bn = trim($data['po_bn']);
|
||||
if (empty($po_bn)) {
|
||||
$result['rsp'] = 'fail';
|
||||
$result['msg'] = '采购单编号不能为空';
|
||||
return $result;
|
||||
}
|
||||
|
||||
// 查询采购单
|
||||
$po_info = $po_mdl->dump(array('po_bn' => $po_bn), 'po_id');
|
||||
if (!$po_info) {
|
||||
$result['rsp'] = 'fail';
|
||||
$result['msg'] = '采购单不存在';
|
||||
return $result;
|
||||
}
|
||||
|
||||
// 操作员
|
||||
$operator = $data['operator'] ? $formatFilter->charFilter($data['operator']) : 'system';
|
||||
|
||||
// 备注
|
||||
$memo = $data['memo'] ? $formatFilter->charFilter($data['memo']) : '';
|
||||
|
||||
// 调用采购取消方法
|
||||
list($rs, $msg) = kernel::single('console_po')->do_cancel($po_info['po_id'], $operator, $memo);
|
||||
|
||||
if (!$rs) {
|
||||
$result['rsp'] = 'fail';
|
||||
$result['msg'] = $msg;
|
||||
} else {
|
||||
$result['data'] = array(
|
||||
'po_bn' => $po_bn,
|
||||
'po_id' => $po_info['po_id']
|
||||
);
|
||||
$result['msg'] = $msg;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,13 +18,6 @@
|
||||
class openapi_data_original_purchasereturn{
|
||||
|
||||
|
||||
/**
|
||||
* 获取List
|
||||
* @param mixed $filter filter
|
||||
* @param mixed $offset offset
|
||||
* @param mixed $limit limit
|
||||
* @return mixed 返回结果
|
||||
*/
|
||||
public function getList($filter,$offset=0,$limit=100){
|
||||
|
||||
$po_mdl = app::get('purchase')->model('returned_purchase');
|
||||
@@ -123,11 +116,6 @@ class openapi_data_original_purchasereturn{
|
||||
|
||||
return $bproduct;
|
||||
}
|
||||
/**
|
||||
* 添加
|
||||
* @param mixed $data 数据
|
||||
* @return mixed 返回值
|
||||
*/
|
||||
public function add($data){
|
||||
|
||||
$basicMaterialLib = kernel::single('material_basic_material');
|
||||
@@ -166,6 +154,7 @@ class openapi_data_original_purchasereturn{
|
||||
$result['msg'] = 'items参数必须为数组!';
|
||||
return $result;
|
||||
}
|
||||
$products = array();
|
||||
foreach ($items as $item) {
|
||||
if(!$item['bn'] || !$item['nums']){
|
||||
$result['rsp'] = 'fail';
|
||||
@@ -177,6 +166,7 @@ class openapi_data_original_purchasereturn{
|
||||
$result['msg'] = '货号'.$item['bn'].'在'.$branch['name'].'仓库不存在!';
|
||||
return $result;
|
||||
}
|
||||
$products[$item['bn']] = $product;
|
||||
if (!is_numeric($item['nums']) || $item['nums'] < 1){
|
||||
$result['rsp'] = 'fail';
|
||||
$result['msg'] = '货号'.$item['bn'].'的退货数量必须为数字且大于0!';
|
||||
@@ -227,6 +217,7 @@ class openapi_data_original_purchasereturn{
|
||||
|
||||
foreach ($items as $item){
|
||||
//插入采购退货单详情
|
||||
$product = $products[$item['bn']];
|
||||
$p = $basicMaterialLib->getBasicMaterialExt($product['product_id']);
|
||||
|
||||
$row = array();
|
||||
@@ -277,4 +268,4 @@ class openapi_data_original_purchasereturn{
|
||||
|
||||
return array('rsp'=>'succ','msg'=>$result['msg']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,13 +16,6 @@
|
||||
*/
|
||||
|
||||
class openapi_data_original_sales{
|
||||
/**
|
||||
* 获取List
|
||||
* @param mixed $filter filter
|
||||
* @param mixed $offset offset
|
||||
* @param mixed $limit limit
|
||||
* @return mixed 返回结果
|
||||
*/
|
||||
public function getList($filter,$offset=0,$limit=100){
|
||||
$sqlstr = '1';
|
||||
$shopObj = app::get('ome')->model('shop');
|
||||
@@ -450,14 +443,32 @@ class openapi_data_original_sales{
|
||||
}
|
||||
|
||||
/**
|
||||
* SalesAmount
|
||||
* @param mixed $start_time start_time
|
||||
* @param mixed $end_time end_time
|
||||
* @param mixed $offset offset
|
||||
* @param mixed $limit limit
|
||||
* @param mixed $shop_bn shop_bn
|
||||
* @return mixed 返回值
|
||||
* 返回所有备注内容
|
||||
* @param string $mark_text 序列化的备注数据
|
||||
* @return string 所有op_content内容,用||连接
|
||||
* @access public
|
||||
*/
|
||||
function getAllMarkText($mark_text)
|
||||
{
|
||||
if (empty($mark_text)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$mark = @unserialize($mark_text);
|
||||
if (!is_array($mark) || empty($mark)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$opContents = array();
|
||||
foreach ($mark as $item) {
|
||||
if (is_array($item) && isset($item['op_content']) && !empty($item['op_content'])) {
|
||||
$opContents[] = $item['op_content'];
|
||||
}
|
||||
}
|
||||
|
||||
return implode('||', $opContents);
|
||||
}
|
||||
|
||||
public function SalesAmount($start_time,$end_time,$offset=0,$limit=100,$shop_bn = false){
|
||||
if(empty($start_time) || empty($end_time)){
|
||||
return false;
|
||||
@@ -534,11 +545,11 @@ class openapi_data_original_sales{
|
||||
|
||||
/**
|
||||
* 销售发货明细
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
* @author CP
|
||||
* @version 4.3.9 2021-08-14T10:54:17+08:00
|
||||
* */
|
||||
**/
|
||||
public function getDeliveryList($filter, $offset = 0, $limit = 100)
|
||||
{
|
||||
$saleDelivMdl = app::get('sales')->model('delivery_order');
|
||||
@@ -583,7 +594,7 @@ class openapi_data_original_sales{
|
||||
$materialExtList = array_column($materialExtList, null, 'bm_id');
|
||||
//获取订单支付方式
|
||||
$orderIds = array_column($itemTmpList, 'order_id');
|
||||
$orders = app::get('ome')->model('orders')->getList('order_id,platform_order_bn,payment,relate_order_bn,order_type',['order_id'=>$orderIds]);
|
||||
$orders = app::get('ome')->model('orders')->getList('order_id,platform_order_bn,payment,relate_order_bn,order_type,mark_text',['order_id'=>$orderIds]);
|
||||
$orders = array_column($orders, null, 'order_id');
|
||||
$sales_arr = app::get('ome')->model('sales')->getList('sale_id,order_id,sale_bn',array('order_id'=>$orderIds),0,-1);
|
||||
$sales_arr = array_column($sales_arr, null, 'order_id');
|
||||
@@ -651,6 +662,7 @@ class openapi_data_original_sales{
|
||||
'order_item_id'=>$value['order_item_id'],
|
||||
'cost_tax' => $cost_tax,
|
||||
'pay_method' => (string) $orders[$value['order_id']]['payment'],
|
||||
'mark_text' => $this->getAllMarkText($orders[$value['order_id']]['mark_text']),
|
||||
'batchs' => $this->_getBatchs($useLifeLog_arr, $value),
|
||||
'props' => $this->_getProps($doiPropsItems[$value['id']]),
|
||||
];
|
||||
@@ -855,4 +867,4 @@ class openapi_data_original_sales{
|
||||
'count' => $count,
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,9 +19,9 @@ class openapi_data_original_transfer{
|
||||
|
||||
/**
|
||||
* 出入库类型映射关系
|
||||
*
|
||||
*
|
||||
* @var string
|
||||
* */
|
||||
**/
|
||||
private $_io_type = array(
|
||||
'E' => '70',
|
||||
'A' => '7',
|
||||
@@ -41,9 +41,9 @@ class openapi_data_original_transfer{
|
||||
|
||||
/**
|
||||
* 出入库单类型
|
||||
*
|
||||
*
|
||||
* @var string
|
||||
* */
|
||||
**/
|
||||
private $_io_status = array(
|
||||
'FINISH' => '3',
|
||||
'PARTFINISH' => '2',
|
||||
@@ -51,11 +51,6 @@ class openapi_data_original_transfer{
|
||||
'NEW' => '1',
|
||||
);
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* @param mixed $data 数据
|
||||
* @return mixed 返回值
|
||||
*/
|
||||
public function add($data){
|
||||
$result = array('rsp'=>'succ');
|
||||
|
||||
@@ -150,7 +145,7 @@ class openapi_data_original_transfer{
|
||||
'product_id' => $product[0]['bm_id'],
|
||||
'name' => $v['name'],
|
||||
'price' => $v['price'],
|
||||
'bn' => $batch['bn'],
|
||||
'bn' => $batch['bn'] ?? $v['bn'],
|
||||
'nums' => $batch['nums'],
|
||||
'batch_code' => $batch['batch_code'],
|
||||
'product_date' => $batch['product_date'],
|
||||
@@ -245,19 +240,6 @@ class openapi_data_original_transfer{
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取List
|
||||
* @param mixed $start_time start_time
|
||||
* @param mixed $end_time end_time
|
||||
* @param mixed $original_bn original_bn
|
||||
* @param mixed $supplier_bn supplier_bn
|
||||
* @param mixed $branch_bn branch_bn
|
||||
* @param mixed $t_type t_type
|
||||
* @param mixed $is_source is_source
|
||||
* @param mixed $offset offset
|
||||
* @param mixed $limit limit
|
||||
* @return mixed 返回结果
|
||||
*/
|
||||
public function getList($start_time,$end_time,$original_bn='',$supplier_bn='',$branch_bn='',$t_type='', $is_source=0, $offset=0,$limit=100){
|
||||
if(empty($start_time) || empty($end_time)){
|
||||
return false;
|
||||
@@ -367,13 +349,6 @@ class openapi_data_original_transfer{
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* 获取IsoList
|
||||
* @param mixed $params 参数
|
||||
* @param mixed $offset offset
|
||||
* @param mixed $limit limit
|
||||
* @return mixed 返回结果
|
||||
*/
|
||||
public function getIsoList($params, $offset, $limit)
|
||||
{
|
||||
$filter = array(
|
||||
|
||||
Reference in New Issue
Block a user