Merge remote-tracking branch 'origin/master'

master
郑明梁 2 years ago
commit 8a4c97aa56

@ -56,6 +56,12 @@ public class InvWarehouseController extends BaseController {
@Resource
private IBasicBussinessTypeService basicBussinessTypeService;
/**
*
*
* @param filterInvSubWarehouseRequest
* @return
*/
@AuthRuleAnnotation("")
@GetMapping("spms/sub/inv/warehouse/filter")
public BaseResponse filterInvWarehouse(FilterInvSubWarehouseRequest filterInvSubWarehouseRequest) {
@ -102,6 +108,32 @@ public class InvWarehouseController extends BaseController {
}
/**
* ()
*
* @param filterInvWarehouseRequest
* @return
*/
@AuthRuleAnnotation("")
@GetMapping("spms/inv/warehouse/findByFrom")
public BaseResponse findByFrom(FilterInvWarehouseRequest filterInvWarehouseRequest) {
if (StrUtil.isEmpty(filterInvWarehouseRequest.getLocInvCode())) {
return ResultVOUtils.error(500, "当前仓库不能为空!");
}
FilterInvSubWarehouseRequest filterInvSubWarehouseRequest = new FilterInvSubWarehouseRequest();
List<InvWarehouseEntity> invWarehouseEntities = invWarehouseService.filterInvSubWarehouse(filterInvSubWarehouseRequest);
List<InvWarehouseEntity> results = new ArrayList<>();
if (CollUtil.isNotEmpty(invWarehouseEntities)) {
invWarehouseEntities.forEach(invWarehouseEntity -> {
if (!invWarehouseEntity.getCode().equals(filterInvWarehouseRequest.getLocInvCode())) {
results.add(invWarehouseEntity);
}
});
}
return ResultVOUtils.success(results);
}
@AuthRuleAnnotation("")
@GetMapping("spms/sub/inv/warehouse/findByInv")
public BaseResponse findByInv(FilterInvWarehouseRequest filterInvWarehouseRequest) {

@ -53,698 +53,6 @@ import java.util.Locale;
public class IoCodeController extends BaseController {
@Resource
private IoCodeService codesService;
@Resource
private IoOrderService orderService;
@Resource
private IBasicBussinessTypeService basicBussinessTypeService;
@Resource
private SpsDirectClient spsDirectClient;
@Resource
IoTransInoutService transInoutService;
@Resource
private SystemParamConfigService systemParamConfigService;
@Resource
UdiRelevanceService udiRelevanceService;
@Resource
UdiProductService udiProductService;
@Resource
BasicUnitMaintainService basicUnitMaintainService;
@Resource
GennerOrderUtils gennerOrderUtils;
@Resource
UdiCalCountUtil udiCalCountUtil;
@Resource
UdiRlSupService udiRlSupService;
//手持端扫码单据上传调用接口
@AuthRuleAnnotation("")
@PostMapping("warehouse/inout/postOrders")
public BaseResponse postOrders(@RequestBody PostOrderRequest postOrderRequest, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
Long userId = getUserId();
try {
PostOrderRequest inPostOrder = new PostOrderRequest();
List<PostOrderRequest.PostOrder> inPostOrders = new ArrayList<>();
PostOrderRequest outPostOrder = new PostOrderRequest();
List<PostOrderRequest.PostOrder> outPostOrders = new ArrayList<>();
List<PostOrderRequest.PostOrder> postOrders = postOrderRequest.getPostOrders();
if (postOrders != null && postOrders.size() > 0) {
for (PostOrderRequest.PostOrder postOrder : postOrders) {
BasicBussinessTypeEntity bussinessTypeEntity = basicBussinessTypeService.findByAction(postOrder.getCodes().get(0).getAction());
if (bussinessTypeEntity.isOutToSpms()) {
outPostOrders.add(postOrder);
} else {
inPostOrders.add(postOrder);
}
}
}
BeanUtils.copyProperties(postOrderRequest, inPostOrder);
BeanUtils.copyProperties(postOrderRequest, outPostOrder);
inPostOrder.setPostOrders(inPostOrders);
outPostOrder.setPostOrders(outPostOrders);
if (CollUtil.isNotEmpty(outPostOrders)) {
outPostOrder.setWmsUserId(userId + "");
return spsDirectClient.uploadPdaOrder(outPostOrder);
}
if (CollUtil.isNotEmpty(inPostOrders)) {
inPostOrder.setCustomerId(getCustomerId());
inPostOrder.setUserId(userId);
transInoutService.creatOrderByPda(inPostOrder);
}
} catch (Exception e) {
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
}
return ResultVOUtils.success("上传成功,等待后台处理");
}
//前端扫码完整性校验
@AuthRuleAnnotation("")
@PostMapping("warehouse/inout/enterCode")
public BaseResponse addEndterCode(@RequestBody AddEnterCodeRequest addEnterCodeRequest) {
if (StrUtil.isEmpty(addEnterCodeRequest.getCode())) {
return ResultVOUtils.error(500, "条码不能为空!");
}
String code = "";
String originCode = addEnterCodeRequest.getOriginCode();
if (originCode == null)
originCode = "";
code = originCode + addEnterCodeRequest.getCode();
String newCode = addEnterCodeRequest.getCode();
//重复判断
if (StrUtil.isNotEmpty(addEnterCodeRequest.getOriginCode())) {
String tempOriginCode = addEnterCodeRequest.getOriginCode();
if (tempOriginCode.endsWith("\u001D")) {
tempOriginCode = tempOriginCode.replace("\u001D", "");
}
UdiEntity originUdiEntity = FilterUdiUtils.getUdi(tempOriginCode);
if (StrUtil.isNotEmpty(newCode)) {
if (newCode.startsWith("10")) {
if (StrUtil.isNotEmpty(originUdiEntity.getBatchNo())) {
BaseResponse baseResponse = ResultVOUtils.error(501, "批次号重复添加");
baseResponse.setData(originCode);
return baseResponse;
} else {
String msg = checkNewCode(originUdiEntity, newCode);
if (msg != null) {
BaseResponse baseResponse = ResultVOUtils.error(501, msg);
baseResponse.setData(originCode);
return baseResponse;
}
}
} else if (newCode.startsWith("17")) {
if (StrUtil.isNotEmpty(originUdiEntity.getExpireDate())) {
BaseResponse baseResponse = ResultVOUtils.error(501, "失效日期重复添加");
baseResponse.setData(originCode);
return baseResponse;
} else {
String msg = checkNewCode(originUdiEntity, newCode);
if (msg != null) {
BaseResponse baseResponse = ResultVOUtils.error(501, msg);
baseResponse.setData(originCode);
return baseResponse;
}
}
} else if (newCode.startsWith("11")) {
if (StrUtil.isNotEmpty(originUdiEntity.getProduceDate())) {
BaseResponse baseResponse = ResultVOUtils.error(501, "生产日期重复添加");
baseResponse.setData(originCode);
return baseResponse;
} else {
String msg = checkNewCode(originUdiEntity, newCode);
if (msg != null) {
BaseResponse baseResponse = ResultVOUtils.error(501, msg);
baseResponse.setData(originCode);
return baseResponse;
}
}
} else if (newCode.startsWith("21")) {
if (StrUtil.isNotEmpty(originUdiEntity.getSerialNo())) {
BaseResponse baseResponse = ResultVOUtils.error(501, "序列号重复添加");
baseResponse.setData(originCode);
return baseResponse;
} else {
String msg = checkNewCode(originUdiEntity, newCode);
if (msg != null) {
BaseResponse baseResponse = ResultVOUtils.error(501, msg);
baseResponse.setData(originCode);
return baseResponse;
}
}
} else {
BaseResponse baseResponse = ResultVOUtils.error(501, "格式错误");
baseResponse.setData(originCode);
return baseResponse;
}
}
}
UdiEntity udiEntity = FilterUdiUtils.getUdi(code);
if (udiEntity == null) {
String sptmtodi = systemParamConfigService.selectValueByParamKey(Constant.SPTM_TO_DI);
if (sptmtodi.equals("1")) {
if (code.length() == 13) {
UdiProductEntity udiProductEntity = udiProductService.findBySptm(code);
if (udiProductEntity != null) {
BaseResponse baseResponse = ResultVOUtils.error(508, "UDI码格式错误");
baseResponse.setData(udiProductEntity);
return baseResponse;
}
}
}
BaseResponse baseResponse = ResultVOUtils.error(501, "UDI码格式错误");
baseResponse.setData(originCode);
return baseResponse;
}
if (StrUtil.isNotEmpty(udiEntity.getBatchNo())) {
if (code.endsWith("10" + udiEntity.getBatchNo())) {
code = code + "\u001D";
}
}
UdiRelevanceResponse checkUdi = udiRelevanceService.selectByNameCode(udiEntity.getUdi());
if (checkUdi == null) {
return ResultVOUtils.error(500, "耗材字典不存在此产品!");
}
boolean checkSuccess = true;
String lostMsg = "";
//校验条码完整性
if ("是".equals(checkUdi.getScbssfbhph()) && StrUtil.isEmpty(udiEntity.getBatchNo())) {
checkSuccess = false;
lostMsg = lostMsg + ",批次号";
}
if ("是".equals(checkUdi.getScbssfbhscrq()) && StrUtil.isEmpty(udiEntity.getProduceDate())) {
checkSuccess = false;
lostMsg = lostMsg + ",生产日期";
}
if ("是".equals(checkUdi.getScbssfbhsxrq()) && StrUtil.isEmpty(udiEntity.getExpireDate())) {
checkSuccess = false;
lostMsg = lostMsg + ",失效日期";
}
if (("是".equals(checkUdi.getScbssfbhxlh()) && StrUtil.isEmpty(udiEntity.getSerialNo()))
) {
checkSuccess = false;
lostMsg = lostMsg + ",序列号";
}
if (StrUtil.isNotEmpty(udiEntity.getSerialNo()) && udiEntity.getSerialNo().length() > 20) {
checkSuccess = false;
return ResultVOUtils.error(504, "序列号超出20位");
}
if (StrUtil.isNotEmpty(udiEntity.getBatchNo()) && udiEntity.getBatchNo().length() > 20) {
checkSuccess = false;
return ResultVOUtils.error(504, "批次号超出20位");
}
if (StrUtil.isEmpty(udiEntity.getSerialNo()) && StrUtil.isEmpty(udiEntity.getBatchNo())) {
checkSuccess = false;
}
if (checkSuccess) {
if (code.endsWith("\u001D")) {
code = code.substring(0, code.length() - "\u001D".length());
}
return ResultVOUtils.success(code);
} else {
if (newCode.startsWith("21") || (StrUtil.isNotEmpty(udiEntity.getSerialNo()) && newCode.contains("21" + udiEntity.getSerialNo()))) {
if (StrUtil.isEmpty(lostMsg)) {
lostMsg = ",";
}
BaseResponse baseResponse = ResultVOUtils.error(503, "条码完整性错误,缺少" + lostMsg.substring(1) + "是否继续添加?");
baseResponse.setData(code);
return baseResponse;
}
}
BaseResponse baseResponse = ResultVOUtils.error(502, "校验未完成");
baseResponse.setData(code);
return baseResponse;
}
public String checkNewCode(UdiEntity originEnity, String newCode) {
UdiEntity newEntity = FilterUdiUtils.getUdi(originEnity.getUdi() + newCode);
if (newEntity == null || originEnity == null) {
return null;
}
if (StrUtil.isNotEmpty(originEnity.getBatchNo()) && StrUtil.isNotEmpty(newEntity.getBatchNo())) {
return "批次号重复添加!";
}
if (StrUtil.isNotEmpty(originEnity.getProduceDate()) && StrUtil.isNotEmpty(newEntity.getProduceDate())) {
return "生产日期重复添加!";
}
if (StrUtil.isNotEmpty(originEnity.getExpireDate()) && StrUtil.isNotEmpty(newEntity.getExpireDate())) {
return "失效日期重复添加!";
}
if (StrUtil.isNotEmpty(originEnity.getSerialNo()) && StrUtil.isNotEmpty(newEntity.getSerialNo())) {
return "序列号重复添加!";
}
return null;
}
//前端扫码提交
@AuthRuleAnnotation("")
@PostMapping("warehouse/inout/addOrderWeb")
public BaseResponse addOrderWeb(@RequestBody AddOrderRequest addOrderRequest, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
AddCodeResult addCodeResult = new AddCodeResult();
if (addOrderRequest.getAction() == null) {
addOrderRequest.setAction(addOrderRequest.getBillType());
}
BasicBussinessTypeEntity bussinessTypeEntity = basicBussinessTypeService.findByAction(addOrderRequest.getAction());
String code = addOrderRequest.getCode();
if (StringUtils.isBlank(code)) return ResultVOUtils.error(ResultEnum.DATA_ERROR);
UdiEntity udiEntity = FilterUdiUtils.getUdi(code);
if (udiEntity == null)
return ResultVOUtils.error(500, "无效条码!");
if (StrUtil.isNotEmpty(addOrderRequest.getBatchNo())) {
udiEntity.setBatchNo(addOrderRequest.getBatchNo());
}
if (StrUtil.isNotEmpty(addOrderRequest.getProduceDate())) {
udiEntity.setProduceDate(addOrderRequest.getProduceDate());
}
if (StrUtil.isNotEmpty(addOrderRequest.getExpireDate())) {
udiEntity.setExpireDate(addOrderRequest.getExpireDate());
}
if (StrUtil.isNotEmpty(addOrderRequest.getSerialNo())) {
udiEntity.setSerialNo(addOrderRequest.getSerialNo());
}
if (StrUtil.isNotEmpty(udiEntity.getSerialNo()) && udiEntity.getSerialNo().length() > 20) {
return ResultVOUtils.error(500, "无效条码!序列号超出最大范围");
}
if (StrUtil.isNotEmpty(udiEntity.getBatchNo()) && udiEntity.getBatchNo().length() > 20) {
return ResultVOUtils.error(500, "无效条码!批次号超出最大范围");
}
//批次号校验
//判断此产品是否开启允许无批次号
UdiProductEntity udiInfoEntity = udiProductService.findByNameCode(udiEntity.getUdi());
if (!udiInfoEntity.getAllowNoBatch()) {
if (StrUtil.isEmpty(udiEntity.getSerialNo()) && StrUtil.isEmpty(udiEntity.getBatchNo())) {
return ResultVOUtils.error(500, "序列号与批次号不能同时为空!");
}
}
String orderId = addOrderRequest.getOrderId();
//三期校验
if (addOrderRequest.isCodeFillCheck()) {
BaseResponse checkOriginCodeRes = checkOriginCode(udiEntity);
if (checkOriginCodeRes != null) {
if (StrUtil.isNotEmpty(orderId)) {
List<IoCodeEnttity> ioCodeEnttities = codesService.findByOrderId(orderId);
IoCodeEnttity ioCodeEnttity = isExitLocal(code, ioCodeEnttities);
if (ioCodeEnttity == null) {
return checkOriginCodeRes;
}
} else
return checkOriginCodeRes;
}
}
//过期提醒:
SystemParamConfigEntity expireParamConfigEntity = systemParamConfigService.selectByParamKey("expire_date_tip");
if (expireParamConfigEntity.getParamValue().equals("1") && !addOrderRequest.isIgnoreExpire()) {
if (StrUtil.isNotEmpty(udiEntity.getExpireDate())) {
String expireDate = "20" + udiEntity.getExpireDate();
long expireTime = DateUtil.parseDateExpire(expireDate);
if (expireTime - System.currentTimeMillis() < 0) {
return ResultVOUtils.error(504, "当前产品已过期,是否确定继续添加?");
}
}
}
//失效期提醒
SystemParamConfigEntity recentParamConfigEntity = systemParamConfigService.selectByParamKey("recent_date_tip");
long recent = Long.parseLong(recentParamConfigEntity.getParamValue());
if (recent > 0 && !addOrderRequest.isIgnoreRecentExpire()) {
if (StrUtil.isNotEmpty(udiEntity.getExpireDate())) {
String expireDate = "20" + udiEntity.getExpireDate();
long expireTime = DateUtil.parseDateExpire(expireDate);
long recentTieme = Math.abs(recent * 24 * 60 * 60 * 1000);
long resultTime = expireTime - System.currentTimeMillis();
if (resultTime > 0) {
long time = resultTime / (24 * 60 * 60 * 1000);
if (resultTime < recentTieme) {
return ResultVOUtils.error(505, "当前产品临近过期,距过期还剩" + time + "天,是否确定继续添加?");
}
}
}
}
//校验预验收是否已存在 todo
if (bussinessTypeEntity.isPreIn()) {
if (StrUtil.isNotEmpty(udiEntity.getSerialNo())) {
// List<InvProductDetailEntity> invProductDetailEntities = invPreInProductDetailService.findByOriginCode(code);
// if (CollUtil.isNotEmpty(invProductDetailEntities)) {
// return ResultVOUtils.error(500, "条码已存在!");
// }
}
}
//校验预验收库存是否已存在
if (addOrderRequest.isPreCheck()) {
// InvProductDetailEntity invProductDetailEntity = invPreInProductDetailService.statInvPreInDetail(code);
// if (invProductDetailEntity == null) {
// return ResultVOUtils.error(500, "预验收库存未存在此产品!");
// } else {
//
//
// if (StrUtil.isNotEmpty(invProductDetailEntity.getBatchNo()) && StrUtil.isNotEmpty(addOrderRequest.getBatchNo())
// && !invProductDetailEntity.getBatchNo().equals(addOrderRequest.getBatchNo())) {
// return ResultVOUtils.error(500, "当前批次号与预验收录入批次号不匹配!");
//
// }
//
//
// if (StrUtil.isNotEmpty(orderId)) {//非首次添加
// if (StrUtil.isEmpty(udiEntity.getSerialNo())) {//该单据已有该产品
// WarehouseQueryRequest warehouseQueryRequest = new WarehouseQueryRequest();
// warehouseQueryRequest.setOrderId(orderId);
// warehouseQueryRequest.setCode(code);
// List<WarehouseEntity> codeEnttitys = codesTempService.findByOrderIdAndCode(warehouseQueryRequest);
// if (CollUtil.isNotEmpty(codeEnttitys)) {
// WarehouseEntity codeEnttity = codeEnttitys.get(0);
// if (invProductDetailEntity.getCount() < (codeEnttity.getCount() + 1)) {
// return ResultVOUtils.error(500, "超出预验收库存数量");
// }
// }
// } else {
// if (invProductDetailEntity.getCount() < 1) {
// return ResultVOUtils.error(500, "超出预验收库存数量");
// }
// }
// }
// }
} else //校验库存是否存在
if (addOrderRequest.isVailInv()) {
// if (bussinessTypeEntity.isAdvanceType()) {
// int count = invPreProductDetailService.vailStockCount(code);
// if (count < 0) {
// return ResultVOUtils.error(500, "当前库存不足不允许0库存出库");
// }
// } else {
// int count = invProductDetailService.vailStockCount(code, addOrderRequest.getLocStorageCode(), addOrderRequest.getInvWarehouseCode(), null);
// if (count <= 0) {
// return ResultVOUtils.error(500, "当前库存不足不允许0库存出库");
// } else if (StrUtil.isNotBlank(addOrderRequest.getOrderId())) {
// //查询此单据已扫描的条码数量
// WarehouseEntity warehouse = codesTempService.findByUnique(addOrderRequest.getOrderId(), addOrderRequest.getCode());
// if (null != warehouse && warehouse.getCount() >= count) {
// return ResultVOUtils.error(500, "当前库存不足不允许0库存出库");
// }
// }
// }
}
if (addOrderRequest.getFromCorp() == null) {
BasicCorpEntity basicCorpEntity = basicUnitMaintainService.selectByName(addOrderRequest.getFromCorp());
if (basicCorpEntity == null && bussinessTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_INPUT && bussinessTypeEntity.isGenUnit()) {
basicCorpEntity = new BasicCorpEntity();
basicCorpEntity.setErpId(CustomUtil.getUnitId());
addOrderRequest.setFromCorp((basicCorpEntity.getErpId()));
basicCorpEntity.setCorpType(ConstantStatus.CORP_SICK);
basicCorpEntity.setOutType(ConstantStatus.CORP_SICK_SICK);
basicCorpEntity.setName(addOrderRequest.getFromCorp());
addOrderRequest.setFromCorp(basicCorpEntity.getName());
basicUnitMaintainService.insertBasicUnitMaintain(basicCorpEntity);
}
}
//先生成扫码单据
IoOrderEntity orderEntity = orderService.findByBillNo(orderId);
if (StringUtils.isBlank(orderId) || orderEntity == null) {
String orderNo = gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER + StrUtil.trim(bussinessTypeEntity.getPrefix()), "yyyyMMdd"));
orderId = orderNo;
}
List<IoCodeEnttity> codeEnttitys = codesService.findByOrderId(orderId);
IoCodeEnttity codeEnttity = new IoCodeEnttity();
IoCodeEnttity exitLocalEntity = null;
if (codeEnttitys.size() > 0) {
exitLocalEntity = isExitLocal(code, codeEnttitys);
if (exitLocalEntity != null) {
codeEnttity = exitLocalEntity;
codeEnttity.setCount(codeEnttity.getCount() + 1);
if (StringUtils.isBlank(codeEnttity.getSerialNo())) {
codesService.updateById(codeEnttity);
} else {
return ResultVOUtils.error(ResultEnum.DATA_REPEAT);
}
}
}
if (exitLocalEntity == null) {
codeEnttity.setCode(code);
codeEnttity.setOrderId(orderId);
codeEnttity.setCorpOrderId(addOrderRequest.getCorpOrderId());
codeEnttity.setCreateTime(new Date());
codeEnttity.setUpdateTime(new Date());
codeEnttity.setMainAction(bussinessTypeEntity.getMainAction());
codeEnttity.setAction(bussinessTypeEntity.getAction());
codeEnttity.setNameCode(udiEntity.getUdi());
codeEnttity.setBatchNo(udiEntity.getBatchNo());
codeEnttity.setProduceDate(udiEntity.getProduceDate());
codeEnttity.setExpireDate(udiEntity.getExpireDate());
codeEnttity.setSerialNo(udiEntity.getSerialNo());
codeEnttity.setDeptCode(addOrderRequest.getDeptCode());
codeEnttity.setInvCode(addOrderRequest.getInvCode());
codeEnttity.setCount(1);
String unitFk = null;
if (bussinessTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_OUT) {
unitFk = addOrderRequest.getFromCorp();
}
//产品是否可以以使用单元入库
List<UdiRelevanceResponse> udiRelevanceResponses = udiRelevanceService.selectAllByNameCode(codeEnttity.getNameCode(), unitFk);
if (udiRelevanceResponses.size() == 1) {
UdiRelevanceResponse udiRelevanceResponse = udiRelevanceResponses.get(0);
if (udiRelevanceResponse == null) {
return ResultVOUtils.error(500, "该产品信息未维护!");
} else if (!udiRelevanceResponse.getIsUseDy() && udiRelevanceResponse.getDiType() == ConstantStatus.DITYPE_SYDY) {
return ResultVOUtils.error(500, "该产品不允许以使用单元入库!");
}
//计算实际数量
codeEnttity.setReCount(codeEnttity.getCount() * udiCalCountUtil.getActCount(udiRelevanceResponse));
} else if (udiRelevanceResponses.size() == 0) {
if (unitFk == null)
return ResultVOUtils.error(500, "耗材字典不存在此产品!");
else
return ResultVOUtils.error(500, "当前供应商不存在此配送产品!");
}
//校验供应商是否配送此产品
BaseResponse corpResponse = checkCorp(codeEnttity, bussinessTypeEntity, unitFk);
if (corpResponse != null) {
return corpResponse;
}
IoOrderEntity isExit = orderService.findById(orderId);
if (isExit == null) {
IoOrderEntity orderSaveRequest = new IoOrderEntity();
orderSaveRequest.setBillNo(orderId);
orderSaveRequest.setCorpOrderId(addOrderRequest.getCorpOrderId());
orderSaveRequest.setMainAction(bussinessTypeEntity.getMainAction());
orderSaveRequest.setAction(bussinessTypeEntity.getAction());
orderSaveRequest.setFromCorp(addOrderRequest.getFromCorp());
orderSaveRequest.setFromInvCode(addOrderRequest.getFromInvCode());
orderSaveRequest.setFromType(ConstantStatus.FROM_WEBNEW);
orderSaveRequest.setStatus(ConstantStatus.ORDER_STATUS_TEMP_SAVE);
orderSaveRequest.setDealStatus(ConstantStatus.ORDER_DEAL_DRAFT);
AuthAdmin authAdmin = getUser();
orderSaveRequest.setCreateUser(authAdmin.getId() + "");
orderSaveRequest.setCreateTime(new Date());
orderSaveRequest.setUpdateUser(authAdmin.getId() + "");
orderSaveRequest.setUpdateTime(new Date());
orderSaveRequest.setCustomerId(authAdmin.getCustomerId());
orderSaveRequest.setDeptCode(addOrderRequest.getDeptCode());
orderSaveRequest.setInvCode(addOrderRequest.getInvCode());
orderService.insertOrder(orderSaveRequest);
}
BaseResponse baseResponse = checkRelId(codeEnttity, unitFk);
codeEnttity = codesService.findByUnique(codeEnttity.getOrderId(), codeEnttity.getCode());
if (baseResponse == null) {
baseResponse = checkSupId(bussinessTypeEntity, codeEnttity, unitFk);
if (baseResponse != null)
return baseResponse;
} else {
if (baseResponse.getCode() == 501) {
return baseResponse;
} else if (baseResponse.getCode() == 502) {
return baseResponse;
}
checkSupId(bussinessTypeEntity, codeEnttity, unitFk);
return baseResponse;
}
}
addCodeResult.setOrderId(orderId);
return ResultVOUtils.success(addCodeResult);
}
//校验条码完整性
public BaseResponse checkOriginCode(UdiEntity udiEntity) {
//校验条码的完整性
String errMsg = "";
UdiRelevanceResponse udiRelevanceResponse = udiRelevanceService.selectByNameCode(udiEntity.getUdi());
if (udiRelevanceResponse == null) {
return ResultVOUtils.error(501, "耗材字典不存在此产品!");
}
if (StrUtil.isEmpty(udiEntity.getBatchNo()) && !udiRelevanceResponse.getAllowNoBatch()) {
errMsg = errMsg + ",批次号";
}
if (StrUtil.isEmpty(udiEntity.getProduceDate()) && !udiRelevanceResponse.getAllowNoProduct()) {
errMsg = errMsg + ",生产日期";
}
if (StrUtil.isEmpty(udiEntity.getExpireDate()) && !udiRelevanceResponse.getAllowNoExpire()) {
errMsg = errMsg + ",失效日期";
}
if (StrUtil.isNotEmpty(errMsg)) {
BaseResponse baseResponse = ResultVOUtils.error(507, "产品三期缺失请补齐" + errMsg.substring(1) + "");
baseResponse.setData(udiEntity);
return baseResponse;
}
return null;
}
//校验供应商是否配送此产品
public BaseResponse checkCorp(IoCodeEnttity codeEnttity, BasicBussinessTypeEntity bussinessTypeEntity, String unitFk) {
if (bussinessTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_OUT) {
CompanyProductRelevanceRequest companyProductRelevanceRequest = new CompanyProductRelevanceRequest();
companyProductRelevanceRequest.setUnitFk(unitFk);
UdiEntity udiEntity = FilterUdiUtils.getUdi(codeEnttity.getCode());
companyProductRelevanceRequest.setNameCode(udiEntity.getUdi());
List<UdiRlSupResponse> datas = udiRlSupService.filterUdiGp(companyProductRelevanceRequest);
if (datas.size() <= 0) {
return ResultVOUtils.error(500, "当前供应商不存在此配送产品!");
}
}
return null;
}
//校验产品ID唯一性
public BaseResponse checkRelId(IoCodeEnttity codeEnttity, String unitFk) {
List<UdiRelevanceResponse> udiRelevanceEntities = udiRelevanceService.selectAllByNameCode(codeEnttity.getNameCode(), unitFk);
if (udiRelevanceEntities != null && udiRelevanceEntities.size() > 1 && codeEnttity.getRelId() == null) {//同一个DI绑定多个产品西信息
codeEnttity.setRelId(null);
codeEnttity.setStatus(ConstantStatus.ORDER_DETAIL_DI_MUTI);
codesService.insert(codeEnttity);
codeEnttity = codesService.findByUnique(codeEnttity.getOrderId(), codeEnttity.getCode());
BaseResponse baseResponse = ResultVOUtils.error(502, "DI绑定多个产品ID,请指定对应产品");
baseResponse.setData(codeEnttity);
return baseResponse;
} else if (udiRelevanceEntities == null || udiRelevanceEntities.size() == 0) {//未找到产品信息,一般不会出现
codeEnttity.setRelId(null);
codeEnttity.setStatus(2);
return ResultVOUtils.error(501, "耗材字典不存在此产品!");
} else {
codeEnttity.setStatus(0);
if (codeEnttity.getRelId() == null)
codeEnttity.setRelId(udiRelevanceEntities.get(0).getId());
codesService.insert(codeEnttity);
}
return null;
}
//校验供应商唯一性
public BaseResponse checkSupId(BasicBussinessTypeEntity bussinessTypeEntity, IoCodeEnttity codeEnttity, String unitFk) {
String originSupId = null;
if (bussinessTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_OUT) {
if (unitFk != null)
originSupId = unitFk;
}
if (originSupId != null) {
codeEnttity.setSupId(originSupId);
} else {
String supId = transInoutService.checkInvExitSup(codeEnttity);
if (supId == null) {
supId = transInoutService.checkExitSup(codeEnttity.getRelId());
}
if (supId == null) {
codeEnttity.setSupId(null);
BaseResponse baseResponse = ResultVOUtils.error(503, "该产品未绑定供应商,请指定对应的供应商");
baseResponse.setData(codeEnttity);
return baseResponse;
} else if ("MUTI".equals(supId)) {
codeEnttity.setSupId(null);
BaseResponse baseResponse = ResultVOUtils.error(503, "该产品绑定多个供应商,请指定对应的供应商");
baseResponse.setData(codeEnttity);
return baseResponse;
} else {
codeEnttity.setSupId(supId);
}
}
codesService.updateById(codeEnttity);
return null;
}
//判断本单是否存在
public IoCodeEnttity isExitLocal(String code, List<IoCodeEnttity> codeEnttityList) {
UdiEntity udiEntity = FilterUdiUtils.getUdi(code);
for (int i = 0; i < codeEnttityList.size(); i++) {
IoCodeEnttity drugCodeSelectEntity = codeEnttityList.get(i);
if (codeEnttityList.get(i).getCode().equals(code)) {
return drugCodeSelectEntity;
}
// UdiEntity originUdiEntity = FilterUdiUtils.getUdi(drugCodeSelectEntity.getCode());
if (!StrUtil.emptyIfNull(drugCodeSelectEntity.getNameCode()).equals(StrUtil.emptyIfNull(udiEntity.getUdi()))) {
continue;
}
if (!StrUtil.emptyIfNull(drugCodeSelectEntity.getBatchNo()).toUpperCase(Locale.ROOT).equals(StrUtil.emptyIfNull(udiEntity.getBatchNo()).toUpperCase(Locale.ROOT))) {
continue;
}
if (!StrUtil.emptyIfNull(drugCodeSelectEntity.getProduceDate()).equals(StrUtil.emptyIfNull(udiEntity.getProduceDate()))) {
continue;
}
if (!StrUtil.emptyIfNull(drugCodeSelectEntity.getExpireDate()).equals(StrUtil.emptyIfNull(udiEntity.getExpireDate()))) {
continue;
}
if (!StrUtil.emptyIfNull(drugCodeSelectEntity.getSerialNo()).equals(StrUtil.emptyIfNull(udiEntity.getSerialNo()))) {
continue;
}
return drugCodeSelectEntity;
}
return null;
}
}

@ -1,25 +1,755 @@
package com.glxp.api.controller.inout;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.glxp.api.annotation.AuthRuleAnnotation;
import com.glxp.api.common.enums.ResultEnum;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.constant.Constant;
import com.glxp.api.constant.ConstantStatus;
import com.glxp.api.controller.BaseController;
import com.glxp.api.entity.auth.AuthAdmin;
import com.glxp.api.entity.auth.InvWarehouseEntity;
import com.glxp.api.entity.basic.BasicBussinessTypeEntity;
import com.glxp.api.entity.basic.BasicCorpEntity;
import com.glxp.api.entity.basic.UdiEntity;
import com.glxp.api.entity.basic.UdiProductEntity;
import com.glxp.api.entity.inout.IoCodeEnttity;
import com.glxp.api.entity.inout.IoCodeTempEntity;
import com.glxp.api.entity.inout.IoCodeTempEntity;
import com.glxp.api.entity.inout.IoOrderEntity;
import com.glxp.api.entity.system.SystemParamConfigEntity;
import com.glxp.api.http.SpsDirectClient;
import com.glxp.api.req.basic.CompanyProductRelevanceRequest;
import com.glxp.api.req.inout.AddEnterCodeRequest;
import com.glxp.api.req.inout.AddOrderRequest;
import com.glxp.api.req.inout.FilterIoCodeRequest;
import com.glxp.api.req.inout.PostOrderRequest;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.basic.UdiRelevanceResponse;
import com.glxp.api.res.basic.UdiRlSupResponse;
import com.glxp.api.res.inout.AddCodeResult;
import com.glxp.api.service.auth.InvWarehouseService;
import com.glxp.api.service.basic.*;
import com.glxp.api.service.inout.IoCodeService;
import com.glxp.api.service.inout.IoCodeTempService;
import com.glxp.api.service.inout.IoOrderService;
import com.glxp.api.service.inout.IoTransInoutService;
import com.glxp.api.service.system.SystemParamConfigService;
import com.glxp.api.util.CustomUtil;
import com.glxp.api.util.DateUtil;
import com.glxp.api.util.GennerOrderUtils;
import com.glxp.api.util.OrderNoTypeBean;
import com.glxp.api.util.page.TableDataInfo;
import com.glxp.api.util.udi.FilterUdiUtils;
import com.glxp.api.util.udi.UdiCalCountUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;
@RestController
public class IoCodeTempController extends BaseController {
@Resource
private IoCodeTempService codeTempService;
@Resource
private IoOrderService orderService;
@Resource
private IBasicBussinessTypeService basicBussinessTypeService;
@Resource
private SpsDirectClient spsDirectClient;
@Resource
IoTransInoutService transInoutService;
@Resource
private SystemParamConfigService systemParamConfigService;
@Resource
UdiRelevanceService udiRelevanceService;
@Resource
UdiProductService udiProductService;
@Resource
BasicUnitMaintainService basicUnitMaintainService;
@Resource
GennerOrderUtils gennerOrderUtils;
@Resource
UdiCalCountUtil udiCalCountUtil;
@Resource
UdiRlSupService udiRlSupService;
@Resource
InvWarehouseService invWarehouseService;
//手持端扫码单据上传调用接口
@AuthRuleAnnotation("")
@PostMapping("warehouse/inout/postOrders")
public BaseResponse postOrders(@RequestBody PostOrderRequest postOrderRequest, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
Long userId = getUserId();
try {
PostOrderRequest inPostOrder = new PostOrderRequest();
List<PostOrderRequest.PostOrder> inPostOrders = new ArrayList<>();
PostOrderRequest outPostOrder = new PostOrderRequest();
List<PostOrderRequest.PostOrder> outPostOrders = new ArrayList<>();
List<PostOrderRequest.PostOrder> postOrders = postOrderRequest.getPostOrders();
if (postOrders != null && postOrders.size() > 0) {
for (PostOrderRequest.PostOrder postOrder : postOrders) {
BasicBussinessTypeEntity bussinessTypeEntity = basicBussinessTypeService.findByAction(postOrder.getCodes().get(0).getAction());
if (bussinessTypeEntity.isOutToSpms()) {
outPostOrders.add(postOrder);
} else {
inPostOrders.add(postOrder);
}
}
}
BeanUtils.copyProperties(postOrderRequest, inPostOrder);
BeanUtils.copyProperties(postOrderRequest, outPostOrder);
inPostOrder.setPostOrders(inPostOrders);
outPostOrder.setPostOrders(outPostOrders);
if (CollUtil.isNotEmpty(outPostOrders)) {
outPostOrder.setWmsUserId(userId + "");
return spsDirectClient.uploadPdaOrder(outPostOrder);
}
if (CollUtil.isNotEmpty(inPostOrders)) {
inPostOrder.setCustomerId(getCustomerId());
inPostOrder.setUserId(userId);
transInoutService.creatOrderByPda(inPostOrder);
}
} catch (Exception e) {
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
}
return ResultVOUtils.success("上传成功,等待后台处理");
}
//前端扫码完整性校验
@AuthRuleAnnotation("")
@PostMapping("warehouse/inout/enterCode")
public BaseResponse addEndterCode(@RequestBody AddEnterCodeRequest addEnterCodeRequest) {
if (StrUtil.isEmpty(addEnterCodeRequest.getCode())) {
return ResultVOUtils.error(500, "条码不能为空!");
}
String code = "";
String originCode = addEnterCodeRequest.getOriginCode();
if (originCode == null)
originCode = "";
code = originCode + addEnterCodeRequest.getCode();
String newCode = addEnterCodeRequest.getCode();
//重复判断
if (StrUtil.isNotEmpty(addEnterCodeRequest.getOriginCode())) {
String tempOriginCode = addEnterCodeRequest.getOriginCode();
if (tempOriginCode.endsWith("\u001D")) {
tempOriginCode = tempOriginCode.replace("\u001D", "");
}
UdiEntity originUdiEntity = FilterUdiUtils.getUdi(tempOriginCode);
if (StrUtil.isNotEmpty(newCode)) {
if (newCode.startsWith("10")) {
if (StrUtil.isNotEmpty(originUdiEntity.getBatchNo())) {
BaseResponse baseResponse = ResultVOUtils.error(501, "批次号重复添加");
baseResponse.setData(originCode);
return baseResponse;
} else {
String msg = checkNewCode(originUdiEntity, newCode);
if (msg != null) {
BaseResponse baseResponse = ResultVOUtils.error(501, msg);
baseResponse.setData(originCode);
return baseResponse;
}
}
} else if (newCode.startsWith("17")) {
if (StrUtil.isNotEmpty(originUdiEntity.getExpireDate())) {
BaseResponse baseResponse = ResultVOUtils.error(501, "失效日期重复添加");
baseResponse.setData(originCode);
return baseResponse;
} else {
String msg = checkNewCode(originUdiEntity, newCode);
if (msg != null) {
BaseResponse baseResponse = ResultVOUtils.error(501, msg);
baseResponse.setData(originCode);
return baseResponse;
}
}
} else if (newCode.startsWith("11")) {
if (StrUtil.isNotEmpty(originUdiEntity.getProduceDate())) {
BaseResponse baseResponse = ResultVOUtils.error(501, "生产日期重复添加");
baseResponse.setData(originCode);
return baseResponse;
} else {
String msg = checkNewCode(originUdiEntity, newCode);
if (msg != null) {
BaseResponse baseResponse = ResultVOUtils.error(501, msg);
baseResponse.setData(originCode);
return baseResponse;
}
}
} else if (newCode.startsWith("21")) {
if (StrUtil.isNotEmpty(originUdiEntity.getSerialNo())) {
BaseResponse baseResponse = ResultVOUtils.error(501, "序列号重复添加");
baseResponse.setData(originCode);
return baseResponse;
} else {
String msg = checkNewCode(originUdiEntity, newCode);
if (msg != null) {
BaseResponse baseResponse = ResultVOUtils.error(501, msg);
baseResponse.setData(originCode);
return baseResponse;
}
}
} else {
BaseResponse baseResponse = ResultVOUtils.error(501, "格式错误");
baseResponse.setData(originCode);
return baseResponse;
}
}
}
UdiEntity udiEntity = FilterUdiUtils.getUdi(code);
if (udiEntity == null) {
String sptmtodi = systemParamConfigService.selectValueByParamKey(Constant.SPTM_TO_DI);
if (sptmtodi.equals("1")) {
if (code.length() == 13) {
UdiProductEntity udiProductEntity = udiProductService.findBySptm(code);
if (udiProductEntity != null) {
BaseResponse baseResponse = ResultVOUtils.error(508, "UDI码格式错误");
baseResponse.setData(udiProductEntity);
return baseResponse;
}
}
}
BaseResponse baseResponse = ResultVOUtils.error(501, "UDI码格式错误");
baseResponse.setData(originCode);
return baseResponse;
}
if (StrUtil.isNotEmpty(udiEntity.getBatchNo())) {
if (code.endsWith("10" + udiEntity.getBatchNo())) {
code = code + "\u001D";
}
}
UdiRelevanceResponse checkUdi = udiRelevanceService.selectByNameCode(udiEntity.getUdi());
if (checkUdi == null) {
return ResultVOUtils.error(500, "耗材字典不存在此产品!");
}
boolean checkSuccess = true;
String lostMsg = "";
//校验条码完整性
if ("是".equals(checkUdi.getScbssfbhph()) && StrUtil.isEmpty(udiEntity.getBatchNo())) {
checkSuccess = false;
lostMsg = lostMsg + ",批次号";
}
if ("是".equals(checkUdi.getScbssfbhscrq()) && StrUtil.isEmpty(udiEntity.getProduceDate())) {
checkSuccess = false;
lostMsg = lostMsg + ",生产日期";
}
if ("是".equals(checkUdi.getScbssfbhsxrq()) && StrUtil.isEmpty(udiEntity.getExpireDate())) {
checkSuccess = false;
lostMsg = lostMsg + ",失效日期";
}
if (("是".equals(checkUdi.getScbssfbhxlh()) && StrUtil.isEmpty(udiEntity.getSerialNo()))
) {
checkSuccess = false;
lostMsg = lostMsg + ",序列号";
}
if (StrUtil.isNotEmpty(udiEntity.getSerialNo()) && udiEntity.getSerialNo().length() > 20) {
return ResultVOUtils.error(504, "序列号超出20位");
}
if (StrUtil.isNotEmpty(udiEntity.getBatchNo()) && udiEntity.getBatchNo().length() > 20) {
return ResultVOUtils.error(504, "批次号超出20位");
}
if (StrUtil.isEmpty(udiEntity.getSerialNo()) && StrUtil.isEmpty(udiEntity.getBatchNo())) {
checkSuccess = false;
}
if (checkSuccess) {
if (code.endsWith("\u001D")) {
code = code.substring(0, code.length() - "\u001D".length());
}
return ResultVOUtils.success(code);
} else {
if (newCode.startsWith("21") || (StrUtil.isNotEmpty(udiEntity.getSerialNo()) && newCode.contains("21" + udiEntity.getSerialNo()))) {
if (StrUtil.isEmpty(lostMsg)) {
lostMsg = ",";
}
BaseResponse baseResponse = ResultVOUtils.error(503, "条码完整性错误,缺少" + lostMsg.substring(1) + "是否继续添加?");
baseResponse.setData(code);
return baseResponse;
}
}
BaseResponse baseResponse = ResultVOUtils.error(502, "校验未完成");
baseResponse.setData(code);
return baseResponse;
}
public String checkNewCode(UdiEntity originEnity, String newCode) {
UdiEntity newEntity = FilterUdiUtils.getUdi(originEnity.getUdi() + newCode);
if (newEntity == null || originEnity == null) {
return null;
}
if (StrUtil.isNotEmpty(originEnity.getBatchNo()) && StrUtil.isNotEmpty(newEntity.getBatchNo())) {
return "批次号重复添加!";
}
if (StrUtil.isNotEmpty(originEnity.getProduceDate()) && StrUtil.isNotEmpty(newEntity.getProduceDate())) {
return "生产日期重复添加!";
}
if (StrUtil.isNotEmpty(originEnity.getExpireDate()) && StrUtil.isNotEmpty(newEntity.getExpireDate())) {
return "失效日期重复添加!";
}
if (StrUtil.isNotEmpty(originEnity.getSerialNo()) && StrUtil.isNotEmpty(newEntity.getSerialNo())) {
return "序列号重复添加!";
}
return null;
}
//前端扫码提交
@AuthRuleAnnotation("")
@PostMapping("warehouse/inout/addOrderWeb")
public BaseResponse addOrderWeb(@RequestBody AddOrderRequest addOrderRequest, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
AddCodeResult addCodeResult = new AddCodeResult();
if (addOrderRequest.getAction() == null) {
addOrderRequest.setAction(addOrderRequest.getBillType());
}
BasicBussinessTypeEntity bussinessTypeEntity = basicBussinessTypeService.findByAction(addOrderRequest.getAction());
InvWarehouseEntity invWarehouseEntity = invWarehouseService.findByInvSubByCode(addOrderRequest.getInvCode());
String code = addOrderRequest.getCode();
if (StringUtils.isBlank(code)) return ResultVOUtils.error(ResultEnum.DATA_ERROR);
UdiEntity udiEntity = FilterUdiUtils.getUdi(code);
if (udiEntity == null)
return ResultVOUtils.error(500, "无效条码!");
if (StrUtil.isNotEmpty(addOrderRequest.getBatchNo())) {
udiEntity.setBatchNo(addOrderRequest.getBatchNo());
}
if (StrUtil.isNotEmpty(addOrderRequest.getProduceDate())) {
udiEntity.setProduceDate(addOrderRequest.getProduceDate());
}
if (StrUtil.isNotEmpty(addOrderRequest.getExpireDate())) {
udiEntity.setExpireDate(addOrderRequest.getExpireDate());
}
if (StrUtil.isNotEmpty(addOrderRequest.getSerialNo())) {
udiEntity.setSerialNo(addOrderRequest.getSerialNo());
}
if (StrUtil.isNotEmpty(udiEntity.getSerialNo()) && udiEntity.getSerialNo().length() > 20) {
return ResultVOUtils.error(500, "无效条码!序列号超出最大范围");
}
if (StrUtil.isNotEmpty(udiEntity.getBatchNo()) && udiEntity.getBatchNo().length() > 20) {
return ResultVOUtils.error(500, "无效条码!批次号超出最大范围");
}
//批次号校验
//判断此产品是否开启允许无批次号
UdiProductEntity udiInfoEntity = udiProductService.findByNameCode(udiEntity.getUdi());
if (!udiInfoEntity.getAllowNoBatch()) {
if (StrUtil.isEmpty(udiEntity.getSerialNo()) && StrUtil.isEmpty(udiEntity.getBatchNo())) {
return ResultVOUtils.error(500, "序列号与批次号不能同时为空!");
}
}
String orderId = addOrderRequest.getOrderId();
//三期校验
if (addOrderRequest.isCodeFillCheck()) {
BaseResponse checkOriginCodeRes = checkOriginCode(udiEntity);
if (checkOriginCodeRes != null) {
if (StrUtil.isNotEmpty(orderId)) {
List<IoCodeTempEntity> ioCodeEnttities = codeTempService.findByOrderId(orderId);
IoCodeTempEntity ioCodeEnttity = isExitLocal(code, ioCodeEnttities);
if (ioCodeEnttity == null) {
return checkOriginCodeRes;
}
} else
return checkOriginCodeRes;
}
}
//过期提醒:
SystemParamConfigEntity expireParamConfigEntity = systemParamConfigService.selectByParamKey("expire_date_tip");
if (expireParamConfigEntity.getParamValue().equals("1") && !addOrderRequest.isIgnoreExpire()) {
if (StrUtil.isNotEmpty(udiEntity.getExpireDate())) {
String expireDate = "20" + udiEntity.getExpireDate();
long expireTime = DateUtil.parseDateExpire(expireDate);
if (expireTime - System.currentTimeMillis() < 0) {
return ResultVOUtils.error(504, "当前产品已过期,是否确定继续添加?");
}
}
}
//失效期提醒
SystemParamConfigEntity recentParamConfigEntity = systemParamConfigService.selectByParamKey("recent_date_tip");
long recent = Long.parseLong(recentParamConfigEntity.getParamValue());
if (recent > 0 && !addOrderRequest.isIgnoreRecentExpire()) {
if (StrUtil.isNotEmpty(udiEntity.getExpireDate())) {
String expireDate = "20" + udiEntity.getExpireDate();
long expireTime = DateUtil.parseDateExpire(expireDate);
long recentTieme = Math.abs(recent * 24 * 60 * 60 * 1000);
long resultTime = expireTime - System.currentTimeMillis();
if (resultTime > 0) {
long time = resultTime / (24 * 60 * 60 * 1000);
if (resultTime < recentTieme) {
return ResultVOUtils.error(505, "当前产品临近过期,距过期还剩" + time + "天,是否确定继续添加?");
}
}
}
}
//校验预验收是否已存在 todo
if (bussinessTypeEntity.isPreIn()) {
if (StrUtil.isNotEmpty(udiEntity.getSerialNo())) {
// List<InvProductDetailEntity> invProductDetailEntities = invPreInProductDetailService.findByOriginCode(code);
// if (CollUtil.isNotEmpty(invProductDetailEntities)) {
// return ResultVOUtils.error(500, "条码已存在!");
// }
}
}
//校验预验收库存是否已存在
if (addOrderRequest.isPreCheck()) {
// InvProductDetailEntity invProductDetailEntity = invPreInProductDetailService.statInvPreInDetail(code);
// if (invProductDetailEntity == null) {
// return ResultVOUtils.error(500, "预验收库存未存在此产品!");
// } else {
//
//
// if (StrUtil.isNotEmpty(invProductDetailEntity.getBatchNo()) && StrUtil.isNotEmpty(addOrderRequest.getBatchNo())
// && !invProductDetailEntity.getBatchNo().equals(addOrderRequest.getBatchNo())) {
// return ResultVOUtils.error(500, "当前批次号与预验收录入批次号不匹配!");
//
// }
//
//
// if (StrUtil.isNotEmpty(orderId)) {//非首次添加
// if (StrUtil.isEmpty(udiEntity.getSerialNo())) {//该单据已有该产品
// WarehouseQueryRequest warehouseQueryRequest = new WarehouseQueryRequest();
// warehouseQueryRequest.setOrderId(orderId);
// warehouseQueryRequest.setCode(code);
// List<WarehouseEntity> codeEnttitys = codesTempService.findByOrderIdAndCode(warehouseQueryRequest);
// if (CollUtil.isNotEmpty(codeEnttitys)) {
// WarehouseEntity codeEnttity = codeEnttitys.get(0);
// if (invProductDetailEntity.getCount() < (codeEnttity.getCount() + 1)) {
// return ResultVOUtils.error(500, "超出预验收库存数量");
// }
// }
// } else {
// if (invProductDetailEntity.getCount() < 1) {
// return ResultVOUtils.error(500, "超出预验收库存数量");
// }
// }
// }
// }
} else //校验库存是否存在
if (addOrderRequest.isVailInv()) {
// if (bussinessTypeEntity.isAdvanceType()) {
// int count = invPreProductDetailService.vailStockCount(code);
// if (count < 0) {
// return ResultVOUtils.error(500, "当前库存不足不允许0库存出库");
// }
// } else {
// int count = invProductDetailService.vailStockCount(code, addOrderRequest.getLocStorageCode(), addOrderRequest.getInvWarehouseCode(), null);
// if (count <= 0) {
// return ResultVOUtils.error(500, "当前库存不足不允许0库存出库");
// } else if (StrUtil.isNotBlank(addOrderRequest.getOrderId())) {
// //查询此单据已扫描的条码数量
// WarehouseEntity warehouse = codesTempService.findByUnique(addOrderRequest.getOrderId(), addOrderRequest.getCode());
// if (null != warehouse && warehouse.getCount() >= count) {
// return ResultVOUtils.error(500, "当前库存不足不允许0库存出库");
// }
// }
// }
}
if (addOrderRequest.getFromCorp() == null) {
BasicCorpEntity basicCorpEntity = basicUnitMaintainService.selectByName(addOrderRequest.getFromCorp());
if (basicCorpEntity == null && bussinessTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_INPUT && bussinessTypeEntity.isGenUnit()) {
basicCorpEntity = new BasicCorpEntity();
basicCorpEntity.setErpId(CustomUtil.getUnitId());
addOrderRequest.setFromCorp((basicCorpEntity.getErpId()));
basicCorpEntity.setCorpType(ConstantStatus.CORP_SICK);
basicCorpEntity.setOutType(ConstantStatus.CORP_SICK_SICK);
basicCorpEntity.setName(addOrderRequest.getFromCorp());
addOrderRequest.setFromCorp(basicCorpEntity.getName());
basicUnitMaintainService.insertBasicUnitMaintain(basicCorpEntity);
}
}
//先生成扫码单据
IoOrderEntity orderEntity = orderService.findByBillNo(orderId);
if (StringUtils.isBlank(orderId) || orderEntity == null) {
String orderNo = gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER + StrUtil.trimToEmpty(bussinessTypeEntity.getPrefix()), "yyyyMMdd"));
orderId = orderNo;
}
List<IoCodeTempEntity> codeEnttitys = codeTempService.findByOrderId(orderId);
IoCodeTempEntity codeEnttity = new IoCodeTempEntity();
IoCodeTempEntity exitLocalEntity = null;
if (codeEnttitys.size() > 0) {
exitLocalEntity = isExitLocal(code, codeEnttitys);
if (exitLocalEntity != null) {
codeEnttity = exitLocalEntity;
codeEnttity.setCount(codeEnttity.getCount() + 1);
if (StringUtils.isBlank(codeEnttity.getSerialNo())) {
codeTempService.updateById(codeEnttity);
} else {
return ResultVOUtils.error(ResultEnum.DATA_REPEAT);
}
}
}
if (exitLocalEntity == null) {
codeEnttity.setCode(code);
codeEnttity.setOrderId(orderId);
codeEnttity.setCorpOrderId(addOrderRequest.getCorpOrderId());
codeEnttity.setCreateTime(new Date());
codeEnttity.setUpdateTime(new Date());
codeEnttity.setMainAction(bussinessTypeEntity.getMainAction());
codeEnttity.setAction(bussinessTypeEntity.getAction());
codeEnttity.setNameCode(udiEntity.getUdi());
codeEnttity.setBatchNo(udiEntity.getBatchNo());
codeEnttity.setProduceDate(udiEntity.getProduceDate());
codeEnttity.setExpireDate(udiEntity.getExpireDate());
codeEnttity.setSerialNo(udiEntity.getSerialNo());
codeEnttity.setDeptCode(invWarehouseEntity.getParentId());
codeEnttity.setInvCode(addOrderRequest.getInvCode());
codeEnttity.setCount(1);
String unitFk = null;
if (bussinessTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_OUT) {
unitFk = addOrderRequest.getFromCorp();
}
//产品是否可以以使用单元入库
List<UdiRelevanceResponse> udiRelevanceResponses = udiRelevanceService.selectAllByNameCode(codeEnttity.getNameCode(), unitFk);
if (udiRelevanceResponses.size() == 1) {
UdiRelevanceResponse udiRelevanceResponse = udiRelevanceResponses.get(0);
if (udiRelevanceResponse == null) {
return ResultVOUtils.error(500, "该产品信息未维护!");
} else if (!udiRelevanceResponse.getIsUseDy() && udiRelevanceResponse.getDiType() == ConstantStatus.DITYPE_SYDY) {
return ResultVOUtils.error(500, "该产品不允许以使用单元入库!");
}
//计算实际数量
codeEnttity.setReCount(codeEnttity.getCount() * udiCalCountUtil.getActCount(udiRelevanceResponse));
} else if (udiRelevanceResponses.size() == 0) {
if (unitFk == null)
return ResultVOUtils.error(500, "耗材字典不存在此产品!");
else
return ResultVOUtils.error(500, "当前供应商不存在此配送产品!");
}
//校验供应商是否配送此产品
BaseResponse corpResponse = checkCorp(codeEnttity, bussinessTypeEntity, unitFk);
if (corpResponse != null) {
return corpResponse;
}
IoOrderEntity isExit = orderService.findById(orderId);
if (isExit == null) {
IoOrderEntity orderSaveRequest = new IoOrderEntity();
orderSaveRequest.setBillNo(orderId);
orderSaveRequest.setCorpOrderId(addOrderRequest.getCorpOrderId());
orderSaveRequest.setMainAction(bussinessTypeEntity.getMainAction());
orderSaveRequest.setAction(bussinessTypeEntity.getAction());
orderSaveRequest.setFromCorp(addOrderRequest.getFromCorp());
orderSaveRequest.setFromInvCode(addOrderRequest.getFromInvCode());
orderSaveRequest.setFromType(ConstantStatus.FROM_WEBNEW);
orderSaveRequest.setStatus(ConstantStatus.ORDER_STATUS_TEMP_SAVE);
orderSaveRequest.setDealStatus(ConstantStatus.ORDER_DEAL_DRAFT);
AuthAdmin authAdmin = getUser();
orderSaveRequest.setCreateUser(authAdmin.getId() + "");
orderSaveRequest.setCreateTime(new Date());
orderSaveRequest.setUpdateUser(authAdmin.getId() + "");
orderSaveRequest.setUpdateTime(new Date());
orderSaveRequest.setCustomerId(authAdmin.getCustomerId());
orderSaveRequest.setDeptCode(invWarehouseEntity.getParentId());
orderSaveRequest.setInvCode(addOrderRequest.getInvCode());
orderService.insertOrder(orderSaveRequest);
}
BaseResponse baseResponse = checkRelId(codeEnttity, unitFk);
codeEnttity = codeTempService.findByUnique(codeEnttity.getOrderId(), codeEnttity.getCode());
if (baseResponse == null) {
baseResponse = checkSupId(bussinessTypeEntity, codeEnttity, unitFk);
if (baseResponse != null)
return baseResponse;
} else {
if (baseResponse.getCode() == 501) {
return baseResponse;
} else if (baseResponse.getCode() == 502) {
return baseResponse;
}
checkSupId(bussinessTypeEntity, codeEnttity, unitFk);
return baseResponse;
}
}
addCodeResult.setOrderId(orderId);
return ResultVOUtils.success(addCodeResult);
}
//校验条码完整性
public BaseResponse checkOriginCode(UdiEntity udiEntity) {
//校验条码的完整性
String errMsg = "";
UdiRelevanceResponse udiRelevanceResponse = udiRelevanceService.selectByNameCode(udiEntity.getUdi());
if (udiRelevanceResponse == null) {
return ResultVOUtils.error(501, "耗材字典不存在此产品!");
}
if (StrUtil.isEmpty(udiEntity.getBatchNo()) && !udiRelevanceResponse.getAllowNoBatch()) {
errMsg = errMsg + ",批次号";
}
if (StrUtil.isEmpty(udiEntity.getProduceDate()) && !udiRelevanceResponse.getAllowNoProduct()) {
errMsg = errMsg + ",生产日期";
}
if (StrUtil.isEmpty(udiEntity.getExpireDate()) && !udiRelevanceResponse.getAllowNoExpire()) {
errMsg = errMsg + ",失效日期";
}
if (StrUtil.isNotEmpty(errMsg)) {
BaseResponse baseResponse = ResultVOUtils.error(507, "产品三期缺失请补齐" + errMsg.substring(1) + "");
baseResponse.setData(udiEntity);
return baseResponse;
}
return null;
}
//校验供应商是否配送此产品
public BaseResponse checkCorp(IoCodeTempEntity codeEnttity, BasicBussinessTypeEntity bussinessTypeEntity, String unitFk) {
if (bussinessTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_OUT) {
CompanyProductRelevanceRequest companyProductRelevanceRequest = new CompanyProductRelevanceRequest();
companyProductRelevanceRequest.setUnitFk(unitFk);
UdiEntity udiEntity = FilterUdiUtils.getUdi(codeEnttity.getCode());
companyProductRelevanceRequest.setNameCode(udiEntity.getUdi());
List<UdiRlSupResponse> datas = udiRlSupService.filterUdiGp(companyProductRelevanceRequest);
if (datas.size() <= 0) {
return ResultVOUtils.error(500, "当前供应商不存在此配送产品!");
}
}
return null;
}
//校验产品ID唯一性
public BaseResponse checkRelId(IoCodeTempEntity codeEnttity, String unitFk) {
List<UdiRelevanceResponse> udiRelevanceEntities = udiRelevanceService.selectAllByNameCode(codeEnttity.getNameCode(), unitFk);
if (udiRelevanceEntities != null && udiRelevanceEntities.size() > 1 && codeEnttity.getRelId() == null) {//同一个DI绑定多个产品西信息
codeEnttity.setRelId(null);
codeEnttity.setStatus(ConstantStatus.ORDER_DETAIL_DI_MUTI);
codeTempService.insert(codeEnttity);
codeEnttity = codeTempService.findByUnique(codeEnttity.getOrderId(), codeEnttity.getCode());
BaseResponse baseResponse = ResultVOUtils.error(502, "DI绑定多个产品ID,请指定对应产品");
baseResponse.setData(codeEnttity);
return baseResponse;
} else if (udiRelevanceEntities == null || udiRelevanceEntities.size() == 0) {//未找到产品信息,一般不会出现
codeEnttity.setRelId(null);
codeEnttity.setStatus(2);
return ResultVOUtils.error(501, "耗材字典不存在此产品!");
} else {
codeEnttity.setStatus(0);
if (codeEnttity.getRelId() == null)
codeEnttity.setRelId(udiRelevanceEntities.get(0).getId());
codeTempService.insert(codeEnttity);
}
return null;
}
//校验供应商唯一性
public BaseResponse checkSupId(BasicBussinessTypeEntity bussinessTypeEntity, IoCodeTempEntity codeEnttity, String unitFk) {
String originSupId = null;
if (bussinessTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_OUT) {
if (unitFk != null)
originSupId = unitFk;
}
if (originSupId != null) {
codeEnttity.setSupId(originSupId);
} else {
IoCodeEnttity ioCodeEnttity = new IoCodeEnttity();
BeanUtils.copyProperties(codeEnttity, ioCodeEnttity);
String supId = transInoutService.checkInvExitSup(ioCodeEnttity);
if (supId == null) {
supId = transInoutService.checkExitSup(codeEnttity.getRelId());
}
if (supId == null) {
codeEnttity.setSupId(null);
BaseResponse baseResponse = ResultVOUtils.error(503, "该产品未绑定供应商,请指定对应的供应商");
baseResponse.setData(codeEnttity);
return baseResponse;
} else if ("MUTI".equals(supId)) {
codeEnttity.setSupId(null);
BaseResponse baseResponse = ResultVOUtils.error(503, "该产品绑定多个供应商,请指定对应的供应商");
baseResponse.setData(codeEnttity);
return baseResponse;
} else {
codeEnttity.setSupId(supId);
}
}
codeTempService.updateById(codeEnttity);
return null;
}
//判断本单是否存在
public IoCodeTempEntity isExitLocal(String code, List<IoCodeTempEntity> codeEnttityList) {
UdiEntity udiEntity = FilterUdiUtils.getUdi(code);
for (int i = 0; i < codeEnttityList.size(); i++) {
IoCodeTempEntity drugCodeSelectEntity = codeEnttityList.get(i);
if (codeEnttityList.get(i).getCode().equals(code)) {
return drugCodeSelectEntity;
}
// UdiEntity originUdiEntity = FilterUdiUtils.getUdi(drugCodeSelectEntity.getCode());
if (!StrUtil.emptyIfNull(drugCodeSelectEntity.getNameCode()).equals(StrUtil.emptyIfNull(udiEntity.getUdi()))) {
continue;
}
if (!StrUtil.emptyIfNull(drugCodeSelectEntity.getBatchNo()).toUpperCase(Locale.ROOT).equals(StrUtil.emptyIfNull(udiEntity.getBatchNo()).toUpperCase(Locale.ROOT))) {
continue;
}
if (!StrUtil.emptyIfNull(drugCodeSelectEntity.getProduceDate()).equals(StrUtil.emptyIfNull(udiEntity.getProduceDate()))) {
continue;
}
if (!StrUtil.emptyIfNull(drugCodeSelectEntity.getExpireDate()).equals(StrUtil.emptyIfNull(udiEntity.getExpireDate()))) {
continue;
}
if (!StrUtil.emptyIfNull(drugCodeSelectEntity.getSerialNo()).equals(StrUtil.emptyIfNull(udiEntity.getSerialNo()))) {
continue;
}
return drugCodeSelectEntity;
}
return null;
}
@AuthRuleAnnotation("")
@ -35,4 +765,5 @@ public class IoCodeTempController extends BaseController {
return ResultVOUtils.success(pageSimpleResponse);
}
}

@ -10,6 +10,7 @@ import javax.annotation.Resource;
@Slf4j
@RestController
public class IoOrderController {
@Resource
IoOrderService orderService;

@ -88,7 +88,7 @@ public class ThrDeptController {
@PostMapping("/spms/thrsys/warehouse/edit")
public BaseResponse edit(@RequestBody @Valid ThrDeptEntity thrDeptEntity,
BindingResult bindingResult,FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest) {
BindingResult bindingResult,FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest,FilterThrDeptRequest filterThrDeptRequest) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
@ -106,13 +106,23 @@ public class ThrDeptController {
//修改仓库
thrInvWarehouseService.updateThrInvWarehouse(thrInvWarehouseEntity);
}
thrDeptEntity.setPid(null); // 不能修改父级 pid
thrDeptEntity.setUpdateTime(new Date());
boolean b = thrDeptService.updateInvWarehouse(thrDeptEntity);
if (!b) {
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
//判断部门是否存在
filterThrDeptRequest.setCode(thrDeptEntity.getCode());
filterThrDeptRequest.setName(thrDeptEntity.getName());
filterThrDeptRequest.setThirdSysFk(thrDeptEntity.getThirdSysFk());
List<ThrDeptEntity> thrDeptEntities = thrDeptService.filterThrInvWarehouse(filterThrDeptRequest);
if(thrDeptEntities.size()==0){
thrDeptEntity.setPid(null); // 不能修改父级 pid
thrDeptEntity.setUpdateTime(new Date());
boolean b = thrDeptService.updateInvWarehouse(thrDeptEntity);
if (!b) {
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
}
return ResultVOUtils.success();
}else{
return ResultVOUtils.error(ResultEnum.DATA_REPEAT);
}
return ResultVOUtils.success();
}
@PostMapping("/spms/thrsys/warehouse/delete")

@ -0,0 +1,8 @@
package com.glxp.api.dao.inout;
import com.glxp.api.dao.BaseMapperPlus;
import com.glxp.api.entity.inout.IoOrderDetailBizEntity;
import com.glxp.api.entity.inout.IoOrderDetailCodeEntity;
public interface IoOrderDetailBizDao extends BaseMapperPlus<IoOrderDetailBizDao, IoOrderDetailBizEntity, IoOrderDetailBizEntity> {
}

@ -0,0 +1,8 @@
package com.glxp.api.dao.inout;
import com.glxp.api.dao.BaseMapperPlus;
import com.glxp.api.entity.inout.IoCodeTempEntity;
import com.glxp.api.entity.inout.IoOrderDetailCodeEntity;
public interface IoOrderDetailCodeDao extends BaseMapperPlus<IoOrderDetailCodeDao, IoOrderDetailCodeEntity, IoOrderDetailCodeEntity> {
}

@ -0,0 +1,8 @@
package com.glxp.api.dao.inout;
import com.glxp.api.dao.BaseMapperPlus;
import com.glxp.api.entity.inout.IoOrderDetailBizEntity;
import com.glxp.api.entity.inout.IoOrderDetailResultEntity;
public interface IoOrderDetailResultDao extends BaseMapperPlus<IoOrderDetailBizDao, IoOrderDetailResultEntity, IoOrderDetailResultEntity> {
}

@ -11,8 +11,9 @@ import java.util.Date;
import lombok.Data;
@Data
@TableName(value = "io_codes")
@TableName(value = "io_code")
public class IoCodeEnttity implements Serializable {
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ -136,7 +137,7 @@ public class IoCodeEnttity implements Serializable {
@TableField(value = "createTime")
private Date createTime;
@TableField(exist = false)
private Integer status; //条码校验状态
private static final long serialVersionUID = 1L;

@ -136,7 +136,7 @@ public class IoCodeTempEntity implements Serializable {
@TableField(value = "createTime")
private Date createTime;
@TableField(exist = false)
private Integer status; //条码校验状态
private static final long serialVersionUID = 1L;

@ -1,6 +1,6 @@
package com.glxp.api.service.inout;
import com.glxp.api.entity.inout.IoCodeEnttity;
import com.glxp.api.entity.inout.IoCodeTempEntity;
import com.glxp.api.entity.inout.IoCodeTempEntity;
import com.glxp.api.req.inout.FilterIoCodeRequest;
import com.glxp.api.util.page.PageQuery;
@ -10,6 +10,13 @@ import java.util.List;
public interface IoCodeTempService {
int insert(IoCodeTempEntity codeEnttity);
boolean insertBatch(List<IoCodeTempEntity> codeEnttities);
int updateById(IoCodeTempEntity codeEnttity);
public IoCodeTempEntity findByUnique(String orderId, String code);
List<IoCodeTempEntity> findByOrderId(String billNo);

@ -0,0 +1,4 @@
package com.glxp.api.service.inout;
public interface IoOrderDetailBizService {
}

@ -0,0 +1,4 @@
package com.glxp.api.service.inout;
public interface IoOrderDetailCodeService {
}

@ -0,0 +1,4 @@
package com.glxp.api.service.inout;
public interface IoOrderDetailResultService {
}

@ -4,22 +4,30 @@ import cn.hutool.core.util.StrUtil;
import com.glxp.api.constant.Constant;
import com.glxp.api.constant.ConstantStatus;
import com.glxp.api.entity.basic.BasicBussinessTypeEntity;
import com.glxp.api.entity.basic.UdiEntity;
import com.glxp.api.entity.basic.UdiRlSupEntity;
import com.glxp.api.entity.inout.IoCodeEnttity;
import com.glxp.api.entity.inout.IoCodeTempEntity;
import com.glxp.api.entity.inout.IoOrderDetailCodeEntity;
import com.glxp.api.entity.inout.IoOrderEntity;
import com.glxp.api.req.basic.CompanyProductRelevanceRequest;
import com.glxp.api.req.basic.FilterCompanyProductRelevanceRequest;
import com.glxp.api.req.inout.PdaCodeEntity;
import com.glxp.api.req.inout.PostOrderRequest;
import com.glxp.api.res.basic.UdiRelevanceResponse;
import com.glxp.api.service.basic.UdiRlSupService;
import com.glxp.api.service.basic.IBasicBussinessTypeService;
import com.glxp.api.util.CustomUtil;
import com.glxp.api.util.DateUtil;
import com.glxp.api.util.GennerOrderUtils;
import com.glxp.api.util.OrderNoTypeBean;
import com.glxp.api.util.udi.FilterUdiUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Service
@ -36,6 +44,7 @@ public class IoTransInoutService {
@Resource
UdiRlSupService udiRlSupService;
//手持终端上传生成扫码单据
public void creatOrderByPda(PostOrderRequest postOrderRequest) {
List<PostOrderRequest.PostOrder> postOrders = postOrderRequest.getPostOrders();
if (postOrders != null && postOrders.size() > 0) {
@ -85,9 +94,8 @@ public class IoTransInoutService {
}
}
//校验条码关联供应商
public String checkExitSup(Long relId) {
//校验条码关联供应商
FilterCompanyProductRelevanceRequest filterCompanyProductRelevanceRequest = new FilterCompanyProductRelevanceRequest();
filterCompanyProductRelevanceRequest.setUdiRlIdFk(relId + "");
List<UdiRlSupEntity> companyProductRelevanceEntities = udiRlSupService.filterCompanyProductRelevance(filterCompanyProductRelevanceRequest);
@ -187,4 +195,11 @@ public class IoTransInoutService {
return null;
}
//生成扫码单据详情
public void transInout(IoOrderEntity orderEntity, IoCodeTempEntity codeTempEntity) {
}
}

@ -1,9 +1,10 @@
package com.glxp.api.service.inout.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.glxp.api.dao.inout.IoCodeDao;
import com.glxp.api.dao.inout.IoCodeTempDao;
import com.glxp.api.entity.auth.SysDictData;
import com.glxp.api.entity.inout.IoCodeEnttity;
import com.glxp.api.entity.inout.IoCodeTempEntity;
import com.glxp.api.entity.inout.IoCodeTempEntity;
import com.glxp.api.req.inout.FilterIoCodeRequest;
import com.glxp.api.service.inout.IoCodeTempService;
@ -23,11 +24,31 @@ public class IoCodeTempServiceImpl implements IoCodeTempService {
@Resource
IoCodeTempDao ioCodeTempDao;
@Override
public int insert(IoCodeTempEntity codeEnttity) {
return ioCodeTempDao.insert(codeEnttity);
}
@Override
public boolean insertBatch(List<IoCodeTempEntity> codeEnttities) {
return ioCodeTempDao.insertBatch(codeEnttities);
}
@Override
public List<IoCodeTempEntity> findByOrderId(String billNo) {
return ioCodeTempDao.selectList(new QueryWrapper<IoCodeTempEntity>().eq("orderId", billNo));
}
@Override
public int updateById(IoCodeTempEntity codeEnttity) {
return ioCodeTempDao.updateById(codeEnttity);
}
@Override
public IoCodeTempEntity findByUnique(String orderId, String code) {
return ioCodeTempDao.selectOne(new QueryWrapper<IoCodeTempEntity>().eq("orderId", orderId).eq("code", code));
}
@Override
public TableDataInfo<IoCodeTempEntity> findByOrderId(FilterIoCodeRequest filterIoCodeRequest) {
PageQuery pageQuery = new PageQuery();

@ -0,0 +1,4 @@
package com.glxp.api.service.inout.impl;
public class IoOrderDetailBizServiceImpl {
}

@ -0,0 +1,4 @@
package com.glxp.api.service.inout.impl;
public class IoOrderDetailCodeServiceImpl {
}

@ -0,0 +1,8 @@
package com.glxp.api.service.inout.impl;
import com.glxp.api.service.inout.IoOrderDetailResultService;
import org.springframework.stereotype.Service;
@Service
public class IoOrderDetailResultServiceImpl implements IoOrderDetailResultService {
}

@ -170,7 +170,7 @@
basic_products.basicPrductRemak5,
basic_products.basicPrductRemak6,
basic_products.basicPrductRemak7,
basic_products.basicPrductRemak8 company_product_relevance.unitFk, basic_corp.name companyName
basic_products.basicPrductRemak8, company_product_relevance.unitFk, basic_corp.name companyName
FROM basic_udirel
inner JOIN basic_products
ON basic_products.uuid = basic_udirel.uuid
@ -436,7 +436,7 @@
basic_products.basicPrductRemak5,
basic_products.basicPrductRemak6,
basic_products.basicPrductRemak7,
basic_products.basicPrductRemak8,
basic_products.basicPrductRemak8
from basic_udirel
INNER JOIN basic_products on basic_udirel.uuid = basic_products.uuid
<where>

@ -33,7 +33,6 @@
company_product_relevance.customerId,
company_product_relevance.auditStatus,
basic_udirel.thirdId,
basic_udirel.thirdName,
basic_udirel.id rlId,
basic_udirel.isUseDy,
basic_udirel.isLock,
@ -41,30 +40,20 @@
basic_udirel.thirdId2,
basic_udirel.thirdId3,
basic_udirel.thirdId4,
basic_udirel.thirdName1,
basic_udirel.thirdName2,
basic_udirel.thirdName3,
basic_udirel.thirdName4,
basic_udirel.ybbm,
basic_udirel.sptm,
basic_udirel.manufactory,
basic_udirel.measname,
basic_udirel.lockStatus,
basic_products.allowNoBatch,
basic_products.allowNoExpire,
basic_products.allowNoProduct,
basic_products.productType,
basic_udirel.isLock,
basic_udirel.mainId,
basic_udirel.isAdavence,
basic_products.originUuid,
basic_products.nameCode,
basic_products.deviceRecordKey,
basic_products.packRatio,
basic_products.packUnit,
basic_products.packLevel,
basic_products.bhxjsl,
basic_products.bhzxxsbzsl,
basic_products.zxxsbzbhsydysl,
basic_products.bhxjcpbm,
basic_products.bzcj,
basic_products.addType,
basic_udirel.isDisable,
basic_products.deviceRecordKey,
basic_products.cpmctymc,
basic_products.cplb,
basic_products.flbm,
@ -75,35 +64,37 @@
basic_products.zczbhhzbapzbh,
basic_products.ylqxzcrbarywmc,
basic_products.sydycpbs,
basic_products.uuid,
basic_products.sjcpbm,
basic_products.versionNumber,
basic_products.diType,
basic_corp.name companyName,
basic_udirel.mainId,
basic_udirel.mainName,
basic_udirel.isAdavence,
basic_products.ybbm,
basic_products.sptm,
basic_products.manufactory,
basic_products.measname,
basic_products.productType,
basic_products.scbssfbhph,
basic_products.scbssfbhxlh,
basic_products.scbssfbhscrq,
basic_products.scbssfbhsxrq,
basic_products.cpms,
basic_products.originUuid,
company_product_relevance.price
,
basic_products.allowNoBatch,
basic_products.allowNoExpire,
basic_products.allowNoProduct,
basic_products.spmc,
basic_products.cpdls
,
basic_products.basicPrductRemak1
,
basic_products.cplx,
basic_products.hchzsb,
basic_products.cpdls,
basic_products.price,
basic_products.basicPrductRemak1,
basic_products.basicPrductRemak2,
basic_products.basicPrductRemak3,
basic_products.basicPrductRemak4,
basic_products.basicPrductRemak5,
basic_products.basicPrductRemak6
,
basic_products.basicPrductRemak6,
basic_products.basicPrductRemak7,
basic_products.basicPrductRemak8
basic_products.basicPrductRemak8,
basic_corp.name companyName,
company_product_relevance.price
FROM company_product_relevance
inner JOIN basic_udirel
ON company_product_relevance.udiRlIdFk = basic_udirel.id

Loading…
Cancel
Save