瀏覽代碼

获取面料资料

qiuenguang 9 月之前
父節點
當前提交
194c06da7e
共有 1 個文件被更改,包括 39 次插入1 次删除
  1. 39 1
      application/api/controller/WorkOrderSpotCheck.php

+ 39 - 1
application/api/controller/WorkOrderSpotCheck.php

@@ -2910,7 +2910,8 @@ class WorkOrderSpotCheck extends Api{
                 ->order('批次号 desc')
                 ->value('批次号');
             if (!empty($LastNumber)){
-                $BatchNumber[0] = 'PCH'.((int)substr($LastNumber,2) + 1);
+                $BatchNumber[0] = 'PCH'.((int)substr($LastNumber,3) + 1);
+
             }else{
                 $BatchNumber[0] = 'PCH1';
             }
@@ -2923,12 +2924,14 @@ class WorkOrderSpotCheck extends Api{
                 '入仓总量' => $param['number'],
                 '库存数量' => $param['number'],
                 '单位' => '米',
+                '实际门幅' => $param['实际门幅'],
                 '状态' => 1,
                 'sys_id' => $param['sys_id'],
                 'sys_rq' => date('Y-m-d H:i:s',time())
             ];
             $ReportData = $param;
             unset($ReportData['关联编号']);
+            unset($ReportData['实际门幅']);
             $ReportData['批次号'] = $BatchNumber[0];
             $ReportData['rq'] = date('Y-m-d H:i:s',time());
             //创建事务,存储库存表数据和入库报工表数据
@@ -2956,11 +2959,13 @@ class WorkOrderSpotCheck extends Api{
                 ->find();
             //构建物料库存数据
             $InventoryData = [
+                '实际门幅' => $param['实际门幅'],
                 '入仓总量' => $Inventory['入仓总量'] + $param['number'],
                 '库存数量' => $Inventory['库存数量'] + $param['number']
             ];
             $ReportData = $param;
             unset($ReportData['关联编号']);
+            unset($ReportData['实际门幅']);
             $ReportData['批次号'] = $BatchNumber[0];
             $ReportData['rq'] = date('Y-m-d H:i:s',time());
             //创建事务,存储库存表数据和入库报工表数据
@@ -3016,4 +3021,37 @@ class WorkOrderSpotCheck extends Api{
             $this->success('成功',$list);
         }
     }
+
+    /**
+     * 获取入库面料信息
+     * @return void
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function getInputDetail()
+    {
+        if ($this->request->isGet() === false){
+            $this->error('请求错误');
+        }
+        $param = $this->request->param();
+        if (empty($param)){
+            $this->error('参数错误');
+        }
+        $list = \db('工单_面料资料')
+            ->alias('b')
+            ->join('物料_库存 a','a.物料编号 = b.BOM_物料编码 AND a.物料名称 = b.BOM_物料名称')
+            ->join('工单关联表 c','a.关联号 = c.关联编号 AND b.BOM_工单编号 = c.订单编号')
+            ->field('a.批次号,a.关联号,a.物料编号,a.物料名称,a.入仓总量,a.库存数量,a.领用数量,a.领用数量,a.单位,a.实际门幅,
+            b.BOM_工单编号,b.BOM_颜色,b.BOM_计划门幅,b.BOM_定额门幅,b.BOM_计划用量 as 计划用料,b.BOM_标准用量 as 定额用料')
+            ->where('c.关联编号',$param['关联编号'])
+            ->where('c.订单编号',$param['订单编号'])
+            ->where('b.BOM_物料编码',$param['物料编码'])
+            ->find();
+        $orderList = \db('工单关联表')
+            ->where('关联编号',$param['关联编号'])
+            ->column('GROUP_CONCAT(DISTINCT 订单编号 SEPARATOR ",") AS 关联订单');
+        $list['关联订单'] = $orderList[0];
+        $this->success('成功',$list);
+    }
 }