|
|
@@ -1376,6 +1376,31 @@ class WorkOrder extends Api
|
|
|
$this->error('参数错误');
|
|
|
}
|
|
|
$num = \db('工单_基本资料')->where('Gd_gdbh',$param['gdbh'])->count();
|
|
|
+ //插入产品资料
|
|
|
+ $productData = \db('产品_基本资料')
|
|
|
+ ->where('产品编号',$param['cpdh'])
|
|
|
+ ->count();
|
|
|
+ if ($productData === 0) {
|
|
|
+ $clientCode = substr($param['cpdh'], 0, 5);
|
|
|
+ $product = [
|
|
|
+ '客户编号' => $clientCode,
|
|
|
+ '客户名称' => $param['khmc'],
|
|
|
+ '产品编号' => $param['cpdh'],
|
|
|
+ '产品名称' => $param['cpmc'],
|
|
|
+ '计量单位' => '万张',
|
|
|
+ '状态' => '',
|
|
|
+ 'Mod_rq' => date('Y-m-d H:i:s', time()),
|
|
|
+ 'UniqID' => \db('产品_基本资料')->order('UniqID desc')->value('UniqID') + 1,
|
|
|
+ ];
|
|
|
+ if (strpos($product['产品名称'], '小盒') === false) {
|
|
|
+ $product['产品类别'] = '条盒';
|
|
|
+ } else {
|
|
|
+ $product['产品类别'] = '小盒';
|
|
|
+ }
|
|
|
+ $productSql = \db('产品_基本资料')->fetchSql(true)->insert($product);
|
|
|
+ \db()->query($productSql);
|
|
|
+ }
|
|
|
+ //插入工单资料
|
|
|
$productDetail = \db('产品_基本资料')->where('产品编号',$param['cpdh'])->find();
|
|
|
if (empty($productDetail)){
|
|
|
$productDetail['客户料号'] = '';
|