支持利库不选择供应商
This commit is contained in:
parent
6a6e31001e
commit
af979cc04b
|
|
@ -32,10 +32,7 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
|
@ -241,6 +238,9 @@ public class PurchaseServiceImpl implements PurchaseService {
|
|||
if (StringUtils.isEmpty(detailsList)) {
|
||||
return ServerResponse.createErroe("发货明细不能为空");
|
||||
}
|
||||
// 把利库和采购都为0的都删掉
|
||||
detailsList.removeIf(Objects::isNull);
|
||||
|
||||
int allCkNum = 0;
|
||||
int allLkNum = 0;
|
||||
SupplierVo supp = new SupplierVo();
|
||||
|
|
@ -249,6 +249,10 @@ public class PurchaseServiceImpl implements PurchaseService {
|
|||
if (StringUtils.isEmpty(detailsList)) {
|
||||
return ServerResponse.createErroe("厂商数据不能为空");
|
||||
}
|
||||
// 采购和利库都是0的数量就不处理
|
||||
if (supInfoList.get(0).getCgNum() == 0 && supInfoList.get(0).getLkNum() == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean hasDuplicates = supInfoList.stream()
|
||||
.collect(Collectors.groupingBy(OutPlanVoSupInfo::getSupId))
|
||||
|
|
@ -280,7 +284,8 @@ public class PurchaseServiceImpl implements PurchaseService {
|
|||
supp.setSupId(supInfo.getSupId());
|
||||
//验证数据
|
||||
int num = supplierMapper.supCheck(supp);
|
||||
if (num < 1) {
|
||||
// 只有采购才需要选择供应商
|
||||
if (num < 1 && supInfo.getCgNum() > 0) {
|
||||
return ServerResponse.createErroe(supInfo.getSupName() + "-厂家合同内无此-" + details.getModel() + "-型号设备");
|
||||
}
|
||||
}
|
||||
|
|
@ -319,6 +324,14 @@ public class PurchaseServiceImpl implements PurchaseService {
|
|||
return ServerResponse.createErroe("新增失败数据异常,请稍后重试");
|
||||
}
|
||||
List<OutPlanVoSupInfo> supInfoList = details.getSupList();
|
||||
// 没有采购的模拟一条假数据
|
||||
for (OutPlanVoSupInfo info : supInfoList) {
|
||||
if (info.getCgNum() <= 0) {
|
||||
info.setContractId("10086");
|
||||
info.setSupId("10086");
|
||||
info.setSupName("库存发出");
|
||||
}
|
||||
}
|
||||
int succ = mapper.insertPurchaseDetailsSupData(details, supInfoList);
|
||||
if (succ != supInfoList.size()) {
|
||||
return ServerResponse.createErroe("新增失败数据异常,请稍后重试");
|
||||
|
|
@ -437,7 +450,7 @@ public class PurchaseServiceImpl implements PurchaseService {
|
|||
supp.setSupId(supInfo.getSupId());
|
||||
//验证数据
|
||||
int num = supplierMapper.supCheck(supp);
|
||||
if (num < 1) {
|
||||
if (num < 1 && supInfo.getCgNum() > 0) {
|
||||
return ServerResponse.createErroe(supInfo.getSupName() + "-厂家合同内无此-" + details.getModel() + "-型号设备");
|
||||
}
|
||||
}
|
||||
|
|
@ -477,6 +490,14 @@ public class PurchaseServiceImpl implements PurchaseService {
|
|||
return ServerResponse.createErroe("新增失败数据异常,请稍后重试");
|
||||
}
|
||||
List<OutPlanVoSupInfo> supInfoList = details.getSupList();
|
||||
// 没有采购的模拟一条假数据
|
||||
for (OutPlanVoSupInfo info : supInfoList) {
|
||||
if (info.getCgNum() <= 0) {
|
||||
info.setContractId("10086");
|
||||
info.setSupId("10086");
|
||||
info.setSupName("库存发出");
|
||||
}
|
||||
}
|
||||
int succ = mapper.insertPurchaseDetailsSupData(details, supInfoList);
|
||||
if (succ != supInfoList.size()) {
|
||||
return ServerResponse.createErroe("新增失败数据异常,请稍后重试");
|
||||
|
|
@ -604,7 +625,7 @@ public class PurchaseServiceImpl implements PurchaseService {
|
|||
supp.setSupId(supInfo.getSupId());
|
||||
//验证数据
|
||||
int num = supplierMapper.supCheck(supp);
|
||||
if (num < 1) {
|
||||
if (num < 1 && supInfo.getCgNum() > 0) {
|
||||
return ServerResponse.createErroe(supInfo.getSupName() + "-厂家合同内无此-" + details.getModel() + "-型号设备");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,9 +12,10 @@ public class SystemUtils {
|
|||
|
||||
public static String windowsPath;
|
||||
|
||||
|
||||
public static String linuxPath;
|
||||
|
||||
public static String otherPath;
|
||||
|
||||
/**
|
||||
* 自动注入
|
||||
*
|
||||
|
|
@ -35,6 +36,12 @@ public class SystemUtils {
|
|||
SystemUtils.linuxPath = linuxPath;
|
||||
}
|
||||
|
||||
@Value("${file.upload_path.other}")
|
||||
public void setOtherPath(String otherPath) {
|
||||
SystemUtils.otherPath = otherPath;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 返回系统
|
||||
*
|
||||
|
|
@ -65,7 +72,7 @@ public class SystemUtils {
|
|||
} else if ("linux".equals(os)) {
|
||||
return linuxPath;
|
||||
} else {
|
||||
return windowsPath;
|
||||
return otherPath;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ file:
|
|||
upload_path:
|
||||
windows: D://files/zg_gqj
|
||||
linux: /home/zg_gqj/files
|
||||
other: /Users/syruan/files
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@
|
|||
#{item.modelId},#{item.cgNum},#{item.lkNum},#{item.supName},#{item.ccDay},#{item.jyDay},#{item.remark})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="updatePurchaseDetailsSupData">
|
||||
update st_plan_out_sup set contract_id=#{contractId},sup_id=#{supId},
|
||||
cg_num=#{cgNum},lk_num=#{lkNum},sup_name=#{supName},cc_day=#{ccDay},jy_day=#{jyDay},
|
||||
|
|
|
|||
Loading…
Reference in New Issue