|
|
|
@ -17,6 +17,7 @@ import com.glxp.api.admin.entity.business.StockOrderDetailEntity;
|
|
|
|
|
import com.glxp.api.admin.entity.business.StockOrderEntity;
|
|
|
|
|
import com.glxp.api.admin.entity.business.StockQRCodeTextEntity;
|
|
|
|
|
import com.glxp.api.admin.entity.info.SystemParamConfigEntity;
|
|
|
|
|
import com.glxp.api.admin.entity.inout.AcceptOrderEntity;
|
|
|
|
|
import com.glxp.api.admin.entity.inout.OrderEntity;
|
|
|
|
|
import com.glxp.api.admin.entity.inout.WarehouseEntity;
|
|
|
|
|
import com.glxp.api.admin.entity.inout.WarehouseUserEntity;
|
|
|
|
@ -112,6 +113,9 @@ public class StockOrderController {
|
|
|
|
|
private BussinessTypeService bussinessTypeService;
|
|
|
|
|
@Resource
|
|
|
|
|
private OrderDao orderDao;
|
|
|
|
|
@Resource
|
|
|
|
|
private RedisUtil redisUtil;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@GetMapping("/udiwms/stock/order/error")
|
|
|
|
@ -721,4 +725,155 @@ public class StockOrderController {
|
|
|
|
|
}
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.NOT_NETWORK, "撤回失败");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//验收单据
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@GetMapping("/udiwms/stock/order/accept/getOrder")
|
|
|
|
|
public BaseResponse getAcceptOrder(String billNo) {
|
|
|
|
|
if (StrUtil.isBlank(billNo)) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StockOrderEntity stockOrderEntity = stockOrderService.findByBillNo(billNo);
|
|
|
|
|
|
|
|
|
|
AcceptOrderEntity acceptOrderEntity = new AcceptOrderEntity();
|
|
|
|
|
acceptOrderEntity.setBillNo(billNo);
|
|
|
|
|
List<StockOrderDetailEntity> datas = (List<StockOrderDetailEntity>) redisUtil.get(ConstantStatus.REDIS_BILLNO + billNo);
|
|
|
|
|
if (CollUtil.isNotEmpty(datas)) {
|
|
|
|
|
acceptOrderEntity.setOrderDetailEntities(datas);
|
|
|
|
|
acceptOrderEntity.setExitAccept(true);
|
|
|
|
|
} else {
|
|
|
|
|
List<StockOrderDetailEntity> stockOrderDetailEntities = stockOrderDetailService.findByOrderIdFk(stockOrderEntity.getId());
|
|
|
|
|
acceptOrderEntity.setOrderDetailEntities(stockOrderDetailEntities);
|
|
|
|
|
acceptOrderEntity.setExitAccept(false);
|
|
|
|
|
}
|
|
|
|
|
return ResultVOUtils.success(acceptOrderEntity);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("/udiwms/stock/order/acceptClear")
|
|
|
|
|
public BaseResponse acceptClear(@RequestBody AcceptOrderEntity acceptOrderEntity) {
|
|
|
|
|
String billNo = acceptOrderEntity.getBillNo();
|
|
|
|
|
redisUtil.del(ConstantStatus.REDIS_BILLNO + billNo);
|
|
|
|
|
redisUtil.del(ConstantStatus.REDIS_BILLNO_CODES + billNo);
|
|
|
|
|
StockOrderEntity stockOrderEntity = stockOrderService.findByBillNo(billNo);
|
|
|
|
|
List<StockOrderDetailEntity> stockOrderDetailEntities = stockOrderDetailService.findByOrderIdFk(stockOrderEntity.getId());
|
|
|
|
|
acceptOrderEntity.setOrderDetailEntities(stockOrderDetailEntities);
|
|
|
|
|
return ResultVOUtils.success(acceptOrderEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("/udiwms/stock/order/accept/addCode")
|
|
|
|
|
public BaseResponse acceptAddCode(@RequestBody AcceptOrderEntity acceptOrderEntity) {
|
|
|
|
|
|
|
|
|
|
StockOrderEntity stockOrderEntity = stockOrderService.findByBillNo(acceptOrderEntity.getBillNo());
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// if (warehouseEntity == null) {
|
|
|
|
|
// return ResultVOUtils.error(500, "非此单UDI码!");
|
|
|
|
|
// }
|
|
|
|
|
List<WarehouseEntity> codeList;
|
|
|
|
|
List<WarehouseEntity> warehouseEntityList = (List<WarehouseEntity>) redisUtil.get(ConstantStatus.REDIS_BILLNO_CODES + acceptOrderEntity.getBillNo());
|
|
|
|
|
if (CollUtil.isEmpty(warehouseEntityList)) {
|
|
|
|
|
codeList = codesService.findByReceiptId(stockOrderEntity.getOrderIdFk());
|
|
|
|
|
} else {
|
|
|
|
|
codeList = warehouseEntityList;
|
|
|
|
|
}
|
|
|
|
|
WarehouseEntity warehouseEntity = isExit(codeList, acceptOrderEntity.getCode());
|
|
|
|
|
if (warehouseEntity == null) {
|
|
|
|
|
return ResultVOUtils.error(500, "非此单UDI码!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int status = checkCodeExit(warehouseEntity.getCode(), codeList);
|
|
|
|
|
if (status == Constant.CHECK_REPEAT) {
|
|
|
|
|
return ResultVOUtils.error(500, "重复扫码!");
|
|
|
|
|
} else if (status == Constant.CHECK_NULL) {
|
|
|
|
|
return ResultVOUtils.error(500, "非此单UDI码!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<StockOrderDetailEntity> stockOrderDetailEntities = acceptOrderEntity.getOrderDetailEntities();
|
|
|
|
|
if (StrUtil.isNotEmpty(acceptOrderEntity.getCode()) && CollUtil.isNotEmpty(stockOrderDetailEntities)) {
|
|
|
|
|
boolean isExit = false;
|
|
|
|
|
for (StockOrderDetailEntity stockOrderDetailEntity : stockOrderDetailEntities) {
|
|
|
|
|
if (stockOrderDetailEntity.getRelId().equals(warehouseEntity.getRelId()) &&
|
|
|
|
|
StrUtil.trimToEmpty(stockOrderDetailEntity.getBatchNo()).equals(StrUtil.trimToEmpty(warehouseEntity.getBatchNo()))
|
|
|
|
|
) {
|
|
|
|
|
stockOrderDetailEntity.setAcceptCount(stockOrderDetailEntity.getAcceptCount() + warehouseEntity.getCount());
|
|
|
|
|
if (stockOrderDetailEntity.getAcceptCount() > stockOrderDetailEntity.getReCount()) {
|
|
|
|
|
return ResultVOUtils.error(500, "数量溢出!");
|
|
|
|
|
}
|
|
|
|
|
isExit = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isExit) {
|
|
|
|
|
redisUtil.set(ConstantStatus.REDIS_BILLNO + acceptOrderEntity.getBillNo(), stockOrderDetailEntities);
|
|
|
|
|
redisUtil.set(ConstantStatus.REDIS_BILLNO_CODES + acceptOrderEntity.getBillNo(), codeList);
|
|
|
|
|
acceptOrderEntity.setOrderDetailEntities(stockOrderDetailEntities);
|
|
|
|
|
if (vailFinish(stockOrderDetailEntities)) {
|
|
|
|
|
acceptOrderEntity.setFinishAccept(true);
|
|
|
|
|
return ResultVOUtils.success(acceptOrderEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ResultVOUtils.success(acceptOrderEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return ResultVOUtils.error(500, "非此单条码!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public WarehouseEntity isExit(List<WarehouseEntity> codeList, String code) {
|
|
|
|
|
if (CollUtil.isNotEmpty(codeList)) {
|
|
|
|
|
for (WarehouseEntity warehouseEntity : codeList) {
|
|
|
|
|
if (warehouseEntity.getCode().equals(code)) {
|
|
|
|
|
return warehouseEntity;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
UdiInfoUtils udiInfoUtils;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int checkCodeExit(String code, List<WarehouseEntity> codesList) {
|
|
|
|
|
if (StrUtil.isNotEmpty(code)) {
|
|
|
|
|
code = code.replace("\r\n", "");
|
|
|
|
|
}
|
|
|
|
|
for (WarehouseEntity checkOrderCodesBean : codesList) {
|
|
|
|
|
if (checkOrderCodesBean.getCode().toUpperCase(Locale.ROOT).equals(code.toUpperCase(Locale.ROOT))) {
|
|
|
|
|
if (checkOrderCodesBean.getStatus() == Constant.DB_CHECK_ED
|
|
|
|
|
&& checkOrderCodesBean.getCount() == checkOrderCodesBean.getScanCount()) {
|
|
|
|
|
return Constant.CHECK_REPEAT;
|
|
|
|
|
}
|
|
|
|
|
int curCount = checkOrderCodesBean.getScanCount() + udiInfoUtils.getActCount(checkOrderCodesBean);
|
|
|
|
|
if (curCount == checkOrderCodesBean.getCount()) {
|
|
|
|
|
checkOrderCodesBean.setStatus(Constant.DB_CHECK_ED);
|
|
|
|
|
}
|
|
|
|
|
checkOrderCodesBean.setScanCount(curCount);
|
|
|
|
|
return Constant.CHECK_EXIT;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return Constant.CHECK_NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean vailFinish(List<StockOrderDetailEntity> stockOrderDetailEntities) {
|
|
|
|
|
if (CollUtil.isNotEmpty(stockOrderDetailEntities)) {
|
|
|
|
|
for (StockOrderDetailEntity stockOrderDetailEntity : stockOrderDetailEntities) {
|
|
|
|
|
if (stockOrderDetailEntity.getReCount() != stockOrderDetailEntity.getAcceptCount()) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|