|
@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.mongodb.internal.operation.FindOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
import org.apache.shiro.SecurityUtils;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.constant.CacheConstant;
|
|
@@ -695,18 +696,21 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
|
|
|
poOrder.getCVCName().equalsIgnoreCase(e.getCVCName()) &&
|
|
|
poOrder.getCVenAbbName().equalsIgnoreCase(e.getCVenAbbName())).findFirst();
|
|
|
FabricCostInvoice newItem = new FabricCostInvoice();
|
|
|
- Double dMoney = 0.0;
|
|
|
+ Double dMoney = 0.0,dNoTaxMoney=0.0;
|
|
|
if (oConvertUtils.listIsNotEmpty(poOrder.getFabricPoOrderInList())){
|
|
|
for (FabricPoOrderIn orderIn : poOrder.getFabricPoOrderInList()){
|
|
|
dMoney = DoubleOperation.add(dMoney, DoubleOperation.mul(orderIn.getIPrice(),orderIn.getIQuantityInvoice(),2));
|
|
|
+ dNoTaxMoney = DoubleOperation.add(dNoTaxMoney, DoubleOperation.mul(orderIn.getINoTaxPrice(),orderIn.getIQuantityInvoice(),2));
|
|
|
}
|
|
|
}
|
|
|
if (findItem.isPresent()) {
|
|
|
newItem = findItem.get();
|
|
|
newItem.setIMoney(DoubleOperation.add(newItem.getIMoney(), dMoney));
|
|
|
+ newItem.setINoTaxMoney(DoubleOperation.add(newItem.getINoTaxMoney(), dNoTaxMoney));
|
|
|
}else{
|
|
|
newItem.setCBusType("普通采购");
|
|
|
newItem.setIMoney(dMoney);
|
|
|
+ newItem.setINoTaxMoney(dNoTaxMoney);
|
|
|
newItem.setCVCName(poOrder.getCVCName());
|
|
|
newItem.setCVenName(poOrder.getCVenName());
|
|
|
newItem.setCVenAbbName(poOrder.getCVenAbbName());
|
|
@@ -720,18 +724,21 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
|
|
|
omOrder.getCVCName().equalsIgnoreCase(e.getCVCName()) &&
|
|
|
omOrder.getCVenAbbName().equalsIgnoreCase(e.getCVenAbbName())).findFirst();
|
|
|
FabricCostInvoice newItem = new FabricCostInvoice();
|
|
|
- Double dMoney = 0.0;
|
|
|
+ Double dMoney = 0.0, dNoTaxMoney=0.0;
|
|
|
if (oConvertUtils.listIsNotEmpty(omOrder.getFabricMoOrderRKList())){
|
|
|
for (FabricMoOrderRK orderIn : omOrder.getFabricMoOrderRKList()){
|
|
|
dMoney = DoubleOperation.add(dMoney, orderIn.getIProcessFee());
|
|
|
+ dNoTaxMoney = DoubleOperation.add(dNoTaxMoney, orderIn.getINoTaxProcessFee());
|
|
|
}
|
|
|
}
|
|
|
if (findItem.isPresent()) {
|
|
|
newItem = findItem.get();
|
|
|
newItem.setIMoney(DoubleOperation.add(newItem.getIMoney(), dMoney));
|
|
|
+ newItem.setINoTaxMoney(DoubleOperation.add(newItem.getINoTaxMoney(), dNoTaxMoney));
|
|
|
}else{
|
|
|
newItem.setCBusType("委外加工");
|
|
|
newItem.setIMoney(dMoney);
|
|
|
+ newItem.setINoTaxMoney(dNoTaxMoney);
|
|
|
newItem.setCVCName(omOrder.getCVCName());
|
|
|
newItem.setCVenName(omOrder.getCVenName());
|
|
|
newItem.setCVenAbbName(omOrder.getCVenAbbName());
|
|
@@ -766,13 +773,22 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
|
|
|
FabricCostInvoice findOutInvoice = findOutInvoiceOpt.get();
|
|
|
findOutInvoice.setIMoney(DoubleOperation.sub(findOutInvoice.getIMoney(),dMoneyYf));
|
|
|
}
|
|
|
-
|
|
|
+ // 设置保存的无税金额
|
|
|
+ if (editData != null){
|
|
|
+ List<FabricCostInvoice> costInvoiceList = editData.getFabricCostInvoiceList();
|
|
|
+ for (FabricCostInvoice costInvoice : fabricCostInvoiceList){
|
|
|
+ Optional<FabricCostInvoice> findOpt = costInvoiceList.stream().filter(e->e.getId().equalsIgnoreCase(costInvoice.getId())).findFirst();
|
|
|
+ if (findOpt.isPresent()){
|
|
|
+ costInvoice.setINoTaxMoney(findOpt.get().getINoTaxMoney());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
// 调整行
|
|
|
FabricCostInvoice adjustItem = FabricCostInvoice.getAdjustItem();
|
|
|
if (editData != null){
|
|
|
List<FabricCostInvoice> costInvoiceList = editData.getFabricCostInvoiceList();
|
|
|
if (oConvertUtils.listIsNotEmpty(costInvoiceList)) {
|
|
|
- Optional<FabricCostInvoice> findOpt = costInvoiceList.stream().filter(e->"调整".equalsIgnoreCase(e.getCVCName())).findFirst();
|
|
|
+ Optional<FabricCostInvoice> findOpt = costInvoiceList.stream().filter(e->"调整行".equalsIgnoreCase(e.getCVCName())).findFirst();
|
|
|
if (findOpt.isPresent()){
|
|
|
adjustItem = findOpt.get();
|
|
|
}
|
|
@@ -1207,7 +1223,6 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
|
|
|
commonIn.setCVCName(rk.getCVCName());
|
|
|
commonIn.setCVenName(rk.getCVenName());
|
|
|
commonIn.setCVenAbbName(rk.getCVenAbbName());
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1235,11 +1250,18 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
|
|
|
for (FabricInPrice inPrice : priceList) {
|
|
|
for (FabricCommonIn commonIn : commonInList) {
|
|
|
Optional<FabricAssemVouchsOrgIn> findOpt = assemVouchsOrgInList.stream().filter(e ->
|
|
|
- e.getAutoId().equals(inPrice.getAutoId()) &&
|
|
|
+ inPrice.getAutoId().equals(e.getAutoId()) &&
|
|
|
commonIn.getInvId().equalsIgnoreCase(e.getCInvIdFinal())).findFirst();
|
|
|
if (findOpt.isPresent()) {
|
|
|
commonIn.setIPrice(DoubleOperation.getScale(inPrice.getIPrice(), 4));
|
|
|
commonIn.setCSourceInvId(findOpt.get().getCInvIdAfter());
|
|
|
+
|
|
|
+ commonIn.setCBusType(inPrice.getCBusType());
|
|
|
+ commonIn.setCCode(inPrice.getCCode());
|
|
|
+ commonIn.setCPlanCode(inPrice.getCPlanCode());
|
|
|
+ commonIn.setCVCName(inPrice.getCVCName());
|
|
|
+ commonIn.setCVenName(inPrice.getCVenName());
|
|
|
+ commonIn.setCVenAbbName(inPrice.getCVenAbbName());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1304,6 +1326,7 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
|
|
|
List<FabricPoOrder> poOrderList = ret.getFabricPoOrderList();
|
|
|
for (FabricPoOrder poOrder : poOrderList){
|
|
|
Double dOutSum = 0.0;
|
|
|
+ List<String> omVenList = new ArrayList<>(); // 委外供应商
|
|
|
if (oConvertUtils.listIsNotEmpty(poOrder.getFabricPoOrderInList())) {
|
|
|
for (FabricPoOrderIn orderIn : poOrder.getFabricPoOrderInList()) {
|
|
|
Double dInLeft = orderIn.getIQuantity(); // 入库剩余数量
|
|
@@ -1316,6 +1339,9 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
|
|
|
if (dCurOutSum<=0){
|
|
|
continue;
|
|
|
}
|
|
|
+ if (oConvertUtils.isNotEmpty(ck.getCOmVenAbbName()) && !omVenList.contains(ck.getCOmVenAbbName())){
|
|
|
+ omVenList.add(ck.getCOmVenAbbName());
|
|
|
+ }
|
|
|
Double dRealOut = Math.min(dInLeft,dCurOutSum);// 对比入库单,本条出库数量
|
|
|
ck.setITempUseSum(DoubleOperation.add(ck.getITempUseSum(),dRealOut));// 出库累计数量
|
|
|
dInLeft = DoubleOperation.sub(dInLeft,dRealOut); // 入库剩余数量
|
|
@@ -1326,7 +1352,8 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- // 设置分配数量、余纱、损耗
|
|
|
+ // 设置分配数量、余纱、损耗、委外供应商
|
|
|
+ poOrder.setOmcVenAbbName(StringUtils.join(omVenList,","));
|
|
|
poOrder.setIQuantityOut(dOutSum);
|
|
|
poOrder.setIQuantityLeft(DoubleOperation.sub(poOrder.getIQuantityIn(),dOutSum));
|
|
|
poOrder.setIQuantityLeftRate(DoubleOperation.div(poOrder.getIQuantityLeft(),poOrder.getIQuantityIn(), 4));
|
|
@@ -1350,6 +1377,7 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
|
|
|
lyysList.add(poOrderOut);
|
|
|
}else if ("其他入库".equalsIgnoreCase(moOrderCK.getCBusType()) ||
|
|
|
"转换入库".equalsIgnoreCase(moOrderCK.getCBusType()) ||
|
|
|
+ oConvertUtils.isNotEmpty(moOrderCK.getCSourceInvId()) && !moOrderCK.getCSourceInvId().equalsIgnoreCase(moOrderCK.getInvOutId()) ||
|
|
|
"杂纱".equalsIgnoreCase(moOrderCK.getCInvNameOut())){
|
|
|
qtrkList.add(poOrderOut);
|
|
|
}
|
|
@@ -1443,10 +1471,14 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
|
|
|
}
|
|
|
// 销售出库和成衣出库
|
|
|
List<FabricMoOrderCK> otherOutList = new ArrayList<>();
|
|
|
- otherOutList.addAll(fabricLossMapper.getOmOutList19(code));// 销售出库
|
|
|
- otherOutList.addAll(fabricLossMapper.getSaleOutList(code));// 成衣材料出库
|
|
|
+ otherOutList.addAll(fabricLossMapper.getOmOutList19(code));// 成衣材料出库
|
|
|
+ otherOutList.addAll(fabricLossMapper.getSaleOutList(code));// 销售出库
|
|
|
allOutList.addAll(otherOutList);
|
|
|
- allOutList.forEach(e->e.setCSourceInvId(""));
|
|
|
+ allOutList.forEach(e->{
|
|
|
+ if (oConvertUtils.isEmpty(e.getCSourceInvId())) {
|
|
|
+ e.setCSourceInvId("");
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
// 获取委外订单出库物料入库详情
|
|
|
if (otherOutList.size()>0) {
|
|
@@ -1456,7 +1488,10 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
|
|
|
inList = getAssemVouchSourceInvId(inList);
|
|
|
for (FabricCommonIn item : inList) {
|
|
|
List<FabricMoOrderCK> findList = otherOutList.stream().filter(e -> e.getInvOutId().equalsIgnoreCase(item.getInvId())).collect(Collectors.toList());
|
|
|
- findList.forEach(e -> e.setCSourceInvId(item.getCSourceInvId()));
|
|
|
+ findList.forEach(e -> {
|
|
|
+ e.setCSourceInvId(item.getCSourceInvId());
|
|
|
+ e.setIQuantityOut(DoubleOperation.mul(e.getIQuantityOut(), item.getIRate(), 2));
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
// 入 - 出 : 出大于0 的,是转入;入大于0 的是转出
|
|
@@ -1577,6 +1612,7 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
|
|
|
orgIn.setCInvIdFinal(commonIn.getInvId());
|
|
|
orgIn.setCInvIdAfter(commonIn.getInvId());
|
|
|
orgIn.setCBusType(commonIn.getCBusType());
|
|
|
+ orgIn.setIRate(1.0);
|
|
|
assemVouchsInvIdList.add(orgIn);
|
|
|
}
|
|
|
// 获取物业原始入库单信息
|
|
@@ -1599,6 +1635,7 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
|
|
|
item.setCTableName(findItem.getCTableName());
|
|
|
item.setCInvIdAfter(findItem.getCInvIdBefore());
|
|
|
item.setAutoId(findItem.getAutoId());
|
|
|
+ item.setIRate(DoubleOperation.mul(item.getIRate(), findItem.getIRate()));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1607,6 +1644,7 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
|
|
|
Optional<FabricAssemVouchsOrgIn> findOpt = assemVouchsInvIdList.stream().filter(e->e.getCInvIdFinal().equals(commonIn.getInvId())).findFirst();
|
|
|
if (findOpt.isPresent()){
|
|
|
commonIn.setCSourceInvId(findOpt.get().getCInvIdAfter());
|
|
|
+ commonIn.setIRate(findOpt.get().getIRate());
|
|
|
}
|
|
|
}
|
|
|
|