|
@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil; |
|
|
import cn.hutool.json.JSONArray; |
|
|
import cn.hutool.json.JSONArray; |
|
|
import cn.hutool.json.JSONObject; |
|
|
import cn.hutool.json.JSONObject; |
|
|
import cn.hutool.json.JSONUtil; |
|
|
import cn.hutool.json.JSONUtil; |
|
|
|
|
|
import com.win.framework.common.exception.ServiceException; |
|
|
import com.win.framework.common.pojo.CustomConditions; |
|
|
import com.win.framework.common.pojo.CustomConditions; |
|
|
import com.win.framework.common.pojo.PageResult; |
|
|
import com.win.framework.common.pojo.PageResult; |
|
|
import com.win.framework.common.util.validation.ValidationUtils; |
|
|
import com.win.framework.common.util.validation.ValidationUtils; |
|
@ -31,8 +32,7 @@ import javax.validation.Validator; |
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
|
|
|
|
|
|
import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception; |
|
|
import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception; |
|
|
import static com.win.module.wms.enums.ErrorCodeConstants.PURCHASECLAIM_REQUEST_IMPORT_LIST_IS_EMPTY; |
|
|
import static com.win.module.wms.enums.ErrorCodeConstants.*; |
|
|
import static com.win.module.wms.enums.ErrorCodeConstants.PURCHASERECEIPT_REQUEST_MAIN_NOT_EXISTS; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 采购收货申请主 Service 实现类 |
|
|
* 采购收货申请主 Service 实现类 |
|
@ -64,7 +64,11 @@ public class PurchasereceiptRequestMainServiceImpl implements PurchasereceiptReq |
|
|
public Long createPurchasereceiptRequestMain(PurchasereceiptRequestMainCreateReqVO createReqVO) { |
|
|
public Long createPurchasereceiptRequestMain(PurchasereceiptRequestMainCreateReqVO createReqVO) { |
|
|
// 插入
|
|
|
// 插入
|
|
|
PurchasereceiptRequestMainDO mainDo = PurchasereceiptRequestMainConvert.INSTANCE.convert(createReqVO); |
|
|
PurchasereceiptRequestMainDO mainDo = PurchasereceiptRequestMainConvert.INSTANCE.convert(createReqVO); |
|
|
|
|
|
this.validatePurchasereceiptRequestMainCreate(mainDo); |
|
|
List<PurchasereceiptRequestDetailDO> subDOList = PurchasereceiptRequestDetailConvert.INSTANCE.convertList03(createReqVO.getSubList()); |
|
|
List<PurchasereceiptRequestDetailDO> subDOList = PurchasereceiptRequestDetailConvert.INSTANCE.convertList03(createReqVO.getSubList()); |
|
|
|
|
|
for (PurchasereceiptRequestDetailDO detailDO : subDOList) { |
|
|
|
|
|
this.validatePurchasereceiptRequestDetailCreate(detailDO); |
|
|
|
|
|
} |
|
|
String number = serialNumberApi.generateCode(RuleCodeEnum.PURCHASE_RECEIPT_REQUEST.getCode()); |
|
|
String number = serialNumberApi.generateCode(RuleCodeEnum.PURCHASE_RECEIPT_REQUEST.getCode()); |
|
|
mainDo.setNumber(number); |
|
|
mainDo.setNumber(number); |
|
|
mainDo.setStatus(DictFrameworkUtils.parseDictDataValue(DictTypeConstants.REQUEST_STATUS, "新增")); |
|
|
mainDo.setStatus(DictFrameworkUtils.parseDictDataValue(DictTypeConstants.REQUEST_STATUS, "新增")); |
|
@ -169,6 +173,33 @@ public class PurchasereceiptRequestMainServiceImpl implements PurchasereceiptReq |
|
|
return errorList; |
|
|
return errorList; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 校验导入,并赋值一些参数,未完全实现 |
|
|
|
|
|
* @param mainDo |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
private void validatePurchasereceiptRequestMainCreate(PurchasereceiptRequestMainDO mainDo) { |
|
|
|
|
|
supplierService.selectSupplier(mainDo.getSupplierCode()); |
|
|
|
|
|
RuleRespVO ruleRespVO = ruleService.deliverGoods(null, mainDo.getSupplierCode(), null); |
|
|
|
|
|
if(ruleRespVO == null) { |
|
|
|
|
|
throw new ServiceException(STDCOSTPRICE_SUPPLIER_CODE_NOT_EXISTS); |
|
|
|
|
|
} else { |
|
|
|
|
|
JSONArray conditionArray = JSONUtil.parseArray(ruleRespVO.getConfiguration()); |
|
|
|
|
|
for (int i = 0; i < conditionArray.size(); i++) { |
|
|
|
|
|
JSONObject conditionObject = conditionArray.getJSONObject(i); |
|
|
|
|
|
if ("WarehouseCode".equals(conditionObject.get("ParamCode"))) { |
|
|
|
|
|
mainDo.setFromWarehouseCode(String.valueOf(conditionObject.get("Value"))); |
|
|
|
|
|
} |
|
|
|
|
|
if ("DockCode".equals(conditionObject.get("ParamCode"))) { |
|
|
|
|
|
mainDo.setToDockCode(String.valueOf(conditionObject.get("Value"))); |
|
|
|
|
|
} |
|
|
|
|
|
if ("OnTheWayLocationCode".equals(conditionObject.get("ParamCode"))) { |
|
|
|
|
|
mainDo.setToWarehouseCode(String.valueOf(conditionObject.get("Value"))); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 校验导入,并赋值一些参数,未完全实现 |
|
|
* 校验导入,并赋值一些参数,未完全实现 |
|
|
* @param mainDo |
|
|
* @param mainDo |
|
@ -188,7 +219,7 @@ public class PurchasereceiptRequestMainServiceImpl implements PurchasereceiptReq |
|
|
} |
|
|
} |
|
|
RuleRespVO ruleRespVO = ruleService.deliverGoods(null, mainDo.getSupplierCode(), null); |
|
|
RuleRespVO ruleRespVO = ruleService.deliverGoods(null, mainDo.getSupplierCode(), null); |
|
|
if(ruleRespVO == null) { |
|
|
if(ruleRespVO == null) { |
|
|
message.append("未查找到供应商【").append(mainDo.getSupplierCode()).append("】送货策略"); |
|
|
message.append(STDCOSTPRICE_SUPPLIER_CODE_NOT_EXISTS.getMsg()); |
|
|
} else { |
|
|
} else { |
|
|
JSONArray conditionArray = JSONUtil.parseArray(ruleRespVO.getConfiguration()); |
|
|
JSONArray conditionArray = JSONUtil.parseArray(ruleRespVO.getConfiguration()); |
|
|
for (int i = 0; i < conditionArray.size(); i++) { |
|
|
for (int i = 0; i < conditionArray.size(); i++) { |
|
@ -207,6 +238,15 @@ public class PurchasereceiptRequestMainServiceImpl implements PurchasereceiptReq |
|
|
return message.toString(); |
|
|
return message.toString(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 校验导入,并赋值一些参数,未完全实现 |
|
|
|
|
|
* @param detailDo |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
private void validatePurchasereceiptRequestDetailCreate(PurchasereceiptRequestDetailDO detailDo) { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 校验导入,并赋值一些参数,未完全实现 |
|
|
* 校验导入,并赋值一些参数,未完全实现 |
|
|
* @param detailDo |
|
|
* @param detailDo |
|
|