|
|
@@ -511,6 +511,8 @@ class PurchaseOrderClass extends BaseClass
|
|
|
$ratioType = $v['ratioType'] ?? 1;
|
|
|
$ratio = $v['ratio'] ?? 1;
|
|
|
$currentProductId = $v['productId'] ?? 0;
|
|
|
+ $currentTotal = $v['totalPrice'] ?? 0;
|
|
|
+ $currentAboutPrice = $v['aboutPrice'] ?? 0;
|
|
|
$unitWeight = $productList[$currentProductId]['weight'] ?? 0;
|
|
|
if (isset($v['itemPrice']) == false || $v['itemPrice'] <= 0) {
|
|
|
util::fail('请填写价格');
|
|
|
@@ -519,7 +521,14 @@ class PurchaseOrderClass extends BaseClass
|
|
|
$thisBigNum = $v['bigNum'];
|
|
|
$totalBigNum = bcadd($totalBigNum, $thisBigNum, 2);
|
|
|
$totalNum = bcadd($totalNum, $thisBigNum, 2);
|
|
|
- $currentTotalPrice = bcmul($thisBigNum, $v['itemPrice'], 2);
|
|
|
+ if ($currentAboutPrice == 1) {
|
|
|
+ if($currentTotal<=0){
|
|
|
+ util::fail('请填写总金额');
|
|
|
+ }
|
|
|
+ $currentTotalPrice = $currentTotal;
|
|
|
+ } else {
|
|
|
+ $currentTotalPrice = bcmul($thisBigNum, $v['itemPrice'], 2);
|
|
|
+ }
|
|
|
$weight = bcmul($unitWeight, $thisBigNum, 2);
|
|
|
} else {
|
|
|
if (isset($v['smallNum']) == false || $v['smallNum'] <= 0) {
|
|
|
@@ -529,13 +538,20 @@ class PurchaseOrderClass extends BaseClass
|
|
|
util::fail('小单位采购,单位比必须固定');
|
|
|
}
|
|
|
if ($ratio <= 1) {
|
|
|
- util::fail('小单位采购,单位比必须大于1');
|
|
|
+ //util::fail('小单位采购,单位比必须大于1');
|
|
|
}
|
|
|
$thisSmallNum = $v['smallNum'];
|
|
|
$changeToBigNum = bcdiv($thisSmallNum, $ratio, 2);
|
|
|
$totalNum = bcadd($totalNum, $changeToBigNum, 2);
|
|
|
$totalSmallNum = bcadd($totalSmallNum, $thisSmallNum, 2);
|
|
|
- $currentTotalPrice = bcmul($thisSmallNum, $v['itemPrice'], 2);
|
|
|
+ if ($currentAboutPrice == 1) {
|
|
|
+ if($currentTotal<=0){
|
|
|
+ util::fail('请填写总金额');
|
|
|
+ }
|
|
|
+ $currentTotalPrice = $currentTotal;
|
|
|
+ } else {
|
|
|
+ $currentTotalPrice = bcmul($thisSmallNum, $v['itemPrice'], 2);
|
|
|
+ }
|
|
|
$weight = bcmul($unitWeight, $changeToBigNum, 2);
|
|
|
}
|
|
|
$kindNum++;
|
|
|
@@ -969,16 +985,24 @@ class PurchaseOrderClass extends BaseClass
|
|
|
foreach ($ghsItemInfo as $v) {
|
|
|
$tmp = [];
|
|
|
$productId = $v['productId'];
|
|
|
+ $currentAboutPrice = $v['aboutPrice'] ?? 0;
|
|
|
+ $currentTotal = $v['totalPrice'] ?? 0;
|
|
|
$itemId = $productData[$productId]['itemId'];
|
|
|
$tmp['orderSn'] = $orderSn;
|
|
|
$tmp['itemId'] = $itemId;
|
|
|
$tmp['productId'] = $v['productId'];
|
|
|
$tmp['itemStock'] = $productData[$productId]['stock'] ?? 0;
|
|
|
$tmp['onStock'] = $productData[$productId]['onStock'] ?? 0;
|
|
|
+ $tmp['aboutPrice'] = $currentAboutPrice;
|
|
|
if (isset($v['bigNum']) && $v['bigNum'] > 0) {
|
|
|
$tmp['itemNum'] = $v['bigNum'];
|
|
|
$tmp['bigPrice'] = $v['itemPrice'];
|
|
|
- $tmp['totalPrice'] = bcmul($v['itemPrice'], $tmp['itemNum'], 2);
|
|
|
+ if ($currentAboutPrice == 1) {
|
|
|
+ $totalPrice = $currentTotal;
|
|
|
+ } else {
|
|
|
+ $totalPrice = bcmul($v['itemPrice'], $tmp['itemNum'], 2);
|
|
|
+ }
|
|
|
+ $tmp['totalPrice'] = $totalPrice;
|
|
|
} else {
|
|
|
$smallNum = $v['smallNum'] ?? 0;
|
|
|
if ($smallNum <= 0) {
|
|
|
@@ -990,13 +1014,18 @@ class PurchaseOrderClass extends BaseClass
|
|
|
}
|
|
|
$ratio = $v['ratio'] ?? 1;
|
|
|
if ($ratio <= 1) {
|
|
|
- util::fail('小单位,单位比必须大于1的哦');
|
|
|
+ //util::fail('小单位,单位比必须大于1的哦');
|
|
|
}
|
|
|
$changeToBigNum = bcdiv($smallNum, $ratio, 2);
|
|
|
$tmp['itemNum'] = $changeToBigNum;
|
|
|
$bigPrice = bcmul($v['itemPrice'], $ratio, 2);
|
|
|
$tmp['bigPrice'] = $bigPrice;
|
|
|
- $tmp['totalPrice'] = bcmul($v['itemPrice'], $smallNum, 2);
|
|
|
+ if ($currentAboutPrice == 1) {
|
|
|
+ $totalPrice = $currentTotal;
|
|
|
+ } else {
|
|
|
+ $totalPrice = bcmul($v['itemPrice'], $smallNum, 2);
|
|
|
+ }
|
|
|
+ $tmp['totalPrice'] = $totalPrice;
|
|
|
}
|
|
|
$batchData[] = $tmp;
|
|
|
}
|