|
|
@@ -229,18 +229,20 @@ class ProductController extends BaseController
|
|
|
$transaction = $connection->beginTransaction();
|
|
|
try {
|
|
|
|
|
|
- $cg = PurchaseClass::getLockById($targetId);
|
|
|
- if (!empty($cg)) {
|
|
|
- if (isset($cg->mainId) == false || $cg->mainId != $this->mainId) {
|
|
|
- util::fail('不是您的采购单');
|
|
|
- }
|
|
|
- //没有发货则先发货
|
|
|
- if ($cg->status == PurchaseClass::STATUS_UN_SEND) {
|
|
|
- $cg = PurchaseClass::orderSend($cg, [], true);
|
|
|
- }
|
|
|
- //确认收货并入库
|
|
|
- if ($cg->status == PurchaseClass::STATUS_SENDING) {
|
|
|
- PurchaseClass::takeToPutIn($cg);
|
|
|
+ if (!empty($targetId)) {
|
|
|
+ $cg = PurchaseClass::getLockById($targetId);
|
|
|
+ if (!empty($cg)) {
|
|
|
+ if (isset($cg->mainId) == false || $cg->mainId != $this->mainId) {
|
|
|
+ util::fail('不是您的采购单');
|
|
|
+ }
|
|
|
+ //没有发货则先发货
|
|
|
+ if ($cg->status == PurchaseClass::STATUS_UN_SEND) {
|
|
|
+ $cg = PurchaseClass::orderSend($cg, [], true);
|
|
|
+ }
|
|
|
+ //确认收货并入库
|
|
|
+ if ($cg->status == PurchaseClass::STATUS_SENDING) {
|
|
|
+ PurchaseClass::takeToPutIn($cg);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|