|
|
@@ -2689,8 +2689,31 @@ class WorkOrderSpotCheck extends Api{
|
|
|
->where('关联号', $item['关联编号'])
|
|
|
->value('批次号');
|
|
|
|
|
|
+ // 更新库存数据
|
|
|
+ $Inventory = \db('物料_库存')
|
|
|
+ ->where('批次号',$item['批次号'])
|
|
|
+ ->field('库存数量,入仓总量')
|
|
|
+ ->find();
|
|
|
+
|
|
|
if ($existingBatch) {
|
|
|
$BatchNumber = $existingBatch; // 已入库,使用原批次号
|
|
|
+ $InventoryData = [
|
|
|
+ '批次号' => $item['批次号'],
|
|
|
+ '关联号' => $item['关联编号'],
|
|
|
+ '物料编号' => $item['物料编码'],
|
|
|
+ '物料名称' => $item['物料名称'],
|
|
|
+ '入仓总量' => $Inventory['入仓总量'] + $item['number'],
|
|
|
+ '库存数量' => $Inventory['库存数量'] + $item['number'],
|
|
|
+ '实际门幅' => $item['实际门幅'],
|
|
|
+ '单位' => $item['单位'],
|
|
|
+ '状态' => 1,
|
|
|
+ 'departname' => $item['departname'],
|
|
|
+ 'remark' => isset($item['remark']) ? $item['remark'] : '',
|
|
|
+ 'sys_id' => $item['sys_id'],
|
|
|
+ 'sys_rq' => date('Y-m-d H:i:s'),
|
|
|
+ ];
|
|
|
+ $sql = \db('物料_库存')->fetchSql(true)->where('批次号',$BatchNumber)->update($InventoryData);
|
|
|
+ \db()->query($sql);
|
|
|
} else {
|
|
|
// 生成新批次号
|
|
|
$currentNumber++;
|