|
|
@@ -616,21 +616,32 @@ sql;
|
|
|
if ($asnDetail['asnno'] == $info['asnno'] &&
|
|
|
$asnDetail['asnlineno'] == $info['asnlineno'] &&
|
|
|
$asnDetail['customerid'] == $info['customerid'] &&
|
|
|
- $asnDetail['sku'] == $info['sku']) $receiveAsn = $asnDetail;
|
|
|
+ $asnDetail['sku'] == $info['sku'] ){
|
|
|
+ $receiveAsn = $asnDetail;
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
-// return $db->transaction(function () use ($db, $info, $receiveAsn, $invlotatt, $time, $who, $asn) {
|
|
|
- if ($receiveAsn && (int)$receiveAsn['receivedqty'] + (int)$info['amount'] < (int)$receiveAsn['expectedqty']) {
|
|
|
- //asn_detail 收货数量+已收数量<预期数量
|
|
|
+
|
|
|
+ if (!$receiveAsn) return true;
|
|
|
+
|
|
|
+ $receivedQty = (int)($receiveAsn['receivedqty']??$receiveAsn['receivedqty_each']); // 已收货数量
|
|
|
+ $amount = (int) $info['amount']; // 当前收货数量
|
|
|
+ $expectedQty = (int)$receiveAsn['expectedqty']; // 预期数量
|
|
|
+
|
|
|
+ if ($receivedQty + $amount < $expectedQty) {
|
|
|
+ // 已收货数量+当前收货数量 < 预期数量
|
|
|
$db->update(DB::raw("UPDATE DOC_ASN_DETAILS SET receivedqty = receivedqty + ?,receivedqty_each = receivedqty_each + ?,linestatus = '30',holdrejectcode ='OK',
|
|
|
reserve_flag ='Y',edittime = TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),receivedtime = TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),editwho = ?,
|
|
|
lotatt01 =?,lotatt02 =?,lotatt03 =?,lotatt04 =?,lotatt05 =?,lotatt06 =?,lotatt07 =?,lotatt08=? WHERE asnno = ? and asnlineno = ?"),
|
|
|
[(int)$info['amount'], (int)$info['amount'], $time, $time, $who, $invlotatt['lotatt01'], $invlotatt['lotatt02'], $invlotatt['lotatt03'], $invlotatt['lotatt04'],
|
|
|
$invlotatt['lotatt05'], $invlotatt['lotatt06'], $invlotatt['lotatt07'], $invlotatt['lotatt08'], $info['asnno'], $info['asnlineno']]);
|
|
|
+
|
|
|
//asn_header 部分收货状态
|
|
|
$db->update(DB::raw("UPDATE DOC_ASN_HEADER SET asnstatus = '30',edittime = TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),editwho = ? WHERE asnno = ?"),
|
|
|
[$time, $who, $info['asnno']]);
|
|
|
- } elseif ($receiveAsn && (int)$receiveAsn['receivedqty'] + (int)$info['amount'] == (int)$receiveAsn['expectedqty']) {
|
|
|
- //asn_detail 收货数量+已收数量=预期数量
|
|
|
+
|
|
|
+ } elseif ($receivedQty + $amount == $expectedQty) {
|
|
|
+ // 已收货数量+当前收货数量 = 预期数量
|
|
|
$db->update(DB::raw("UPDATE DOC_ASN_DETAILS SET receivedqty=receivedqty+?,receivedqty_each=receivedqty_each+?,linestatus = '40',
|
|
|
edittime = TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),receivedtime = TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),editwho = ?,holdrejectcode='OK',
|
|
|
reserve_flag='Y',lotatt01=?,lotatt02=?,lotatt03=?,lotatt04=?,lotatt05=?,lotatt06=?,lotatt07=?,lotatt08=? WHERE asnno = ? and asnlineno = ?"),
|
|
|
@@ -647,7 +658,6 @@ sql;
|
|
|
}
|
|
|
}
|
|
|
return true;
|
|
|
-// });
|
|
|
}
|
|
|
|
|
|
/**
|