mirror of
https://gitee.com/ShopeX/OMS
synced 2026-04-18 03:15:33 +08:00
1. 【新增】售后单售后原因类型支持搜索
2. 【新增】手工创建订单折扣可输入正数 3. 【优化】盘点申请单确认 4. 【修复】采购退货单模拟出库失败问题 5. 【新增】订单金额客户实付与结算金额 6. 【优化】仓库发货统计报表物料名称显示 7. 【优化】自有仓储虚拟发货逻辑 8. 【修复】基础物料分类管理问题
This commit is contained in:
68
app/omeauto/lib/order/label/customer.php
Normal file
68
app/omeauto/lib/order/label/customer.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/**
|
||||
* 按客户分类给订单打标签
|
||||
*/
|
||||
class omeauto_order_label_customer extends omeauto_order_label_abstract implements omeauto_order_label_interface
|
||||
{
|
||||
/**
|
||||
* 检查订单数据是否符合要求
|
||||
*
|
||||
* @param array $orderInfo
|
||||
* @param string $error_msg
|
||||
* @return bool
|
||||
*/
|
||||
public function vaild($orderInfo, &$error_msg=null)
|
||||
{
|
||||
if(empty($this->content)){
|
||||
$error_msg = '没有设置客户分类规则';
|
||||
return false;
|
||||
}
|
||||
|
||||
$salesMaterialObj = app::get('material')->model('sales_material');
|
||||
|
||||
// 客户分类ID
|
||||
$class_id = intval($this->content['class_id']);
|
||||
|
||||
//获取订单明细中的基础物料
|
||||
$goodsIds = [];
|
||||
foreach ($orderInfo['order_objects'] as $objKey => $objVal)
|
||||
{
|
||||
$goods_id = $objVal['goods_id'];
|
||||
if($goods_id){
|
||||
$goodsIds[$goods_id] = $goods_id;
|
||||
}
|
||||
}
|
||||
|
||||
// 没有销售物料
|
||||
if(empty($goodsIds)){
|
||||
$error_msg = '订单商品明细';
|
||||
return false;
|
||||
}
|
||||
|
||||
// 销售物料列表
|
||||
$saleMaterialList = $salesMaterialObj->getList('sm_id,sales_material_bn,class_id', array('sm_id'=>$goodsIds));
|
||||
if(empty($saleMaterialList)){
|
||||
$error_msg = '订单明细商品未创建销售物料';
|
||||
return false;
|
||||
}
|
||||
|
||||
// 获取指定的客户分类
|
||||
$findGoods = [];
|
||||
foreach ($saleMaterialList as $key => $val)
|
||||
{
|
||||
$sm_id = $val['sm_id'];
|
||||
|
||||
//check
|
||||
if($val['class_id'] == $class_id){
|
||||
$findGoods[$sm_id] = $val['sales_material_bn'];
|
||||
}
|
||||
}
|
||||
|
||||
if(empty($findGoods)){
|
||||
$error_msg = '订单商品没有符合的客户分类';
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user