|
|
|
@ -28,8 +28,7 @@ import static com.aucma.common.utils.SecurityUtils.getUsername;
|
|
|
|
|
* @date 2023-10-07
|
|
|
|
|
*/
|
|
|
|
|
@Service
|
|
|
|
|
public class ProductPlanInfoServiceImpl implements IProductPlanInfoService
|
|
|
|
|
{
|
|
|
|
|
public class ProductPlanInfoServiceImpl implements IProductPlanInfoService {
|
|
|
|
|
@Autowired
|
|
|
|
|
private ProductPlanInfoMapper productPlanInfoMapper;
|
|
|
|
|
|
|
|
|
@ -46,8 +45,7 @@ public class ProductPlanInfoServiceImpl implements IProductPlanInfoService
|
|
|
|
|
* @return 生产计划
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public ProductPlanInfo selectProductPlanInfoByObjId(Long objId)
|
|
|
|
|
{
|
|
|
|
|
public ProductPlanInfo selectProductPlanInfoByObjId(Long objId) {
|
|
|
|
|
return productPlanInfoMapper.selectProductPlanInfoByObjId(objId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -58,8 +56,7 @@ public class ProductPlanInfoServiceImpl implements IProductPlanInfoService
|
|
|
|
|
* @return 生产计划
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public List<ProductPlanInfo> selectProductPlanInfoList(ProductPlanInfo productPlanInfo)
|
|
|
|
|
{
|
|
|
|
|
public List<ProductPlanInfo> selectProductPlanInfoList(ProductPlanInfo productPlanInfo) {
|
|
|
|
|
return productPlanInfoMapper.selectProductPlanInfoList(productPlanInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -70,11 +67,7 @@ public class ProductPlanInfoServiceImpl implements IProductPlanInfoService
|
|
|
|
|
* @return 结果
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public int insertProductPlanInfo(ProductPlanInfo productPlanInfo)
|
|
|
|
|
{
|
|
|
|
|
if (StringUtils.isEmpty(productPlanInfo.getCreatedBy())){
|
|
|
|
|
productPlanInfo.setCreatedBy(getUsername());
|
|
|
|
|
}
|
|
|
|
|
public int insertProductPlanInfo(ProductPlanInfo productPlanInfo) {
|
|
|
|
|
productPlanInfo.setCreatedTime(DateUtils.getNowDate());
|
|
|
|
|
return productPlanInfoMapper.insertProductPlanInfo(productPlanInfo);
|
|
|
|
|
}
|
|
|
|
@ -86,8 +79,7 @@ public class ProductPlanInfoServiceImpl implements IProductPlanInfoService
|
|
|
|
|
* @return 结果
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public int updateProductPlanInfo(ProductPlanInfo productPlanInfo)
|
|
|
|
|
{
|
|
|
|
|
public int updateProductPlanInfo(ProductPlanInfo productPlanInfo) {
|
|
|
|
|
productPlanInfo.setUpdatedTime(DateUtils.getNowDate());
|
|
|
|
|
return productPlanInfoMapper.updateProductPlanInfo(productPlanInfo);
|
|
|
|
|
}
|
|
|
|
@ -99,8 +91,7 @@ public class ProductPlanInfoServiceImpl implements IProductPlanInfoService
|
|
|
|
|
* @return 结果
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public int deleteProductPlanInfoByObjIds(Long[] objIds)
|
|
|
|
|
{
|
|
|
|
|
public int deleteProductPlanInfoByObjIds(Long[] objIds) {
|
|
|
|
|
return productPlanInfoMapper.deleteProductPlanInfoByObjIds(objIds);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -111,37 +102,41 @@ public class ProductPlanInfoServiceImpl implements IProductPlanInfoService
|
|
|
|
|
* @return 结果
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public int deleteProductPlanInfoByObjId(Long objId)
|
|
|
|
|
{
|
|
|
|
|
public int deleteProductPlanInfoByObjId(Long objId) {
|
|
|
|
|
return productPlanInfoMapper.deleteProductPlanInfoByObjId(objId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 工单计划下达
|
|
|
|
|
*
|
|
|
|
|
* @param baseOrderInfo
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public Boolean releaseOrderPlan(BaseOrderInfo baseOrderInfo) {
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
String orderCode = baseOrderInfo.getOrderCode();
|
|
|
|
|
String saleOrderCode = baseOrderInfo.getSaleOrderCode();
|
|
|
|
|
String saleOrderLineNumber = baseOrderInfo.getSaleOrderLineNumber();
|
|
|
|
|
BigDecimal orderAmount = baseOrderInfo.getOrderAmount();
|
|
|
|
|
int i = orderAmount.compareTo(new BigDecimal(1));
|
|
|
|
|
if (orderAmount.compareTo(new BigDecimal(1)) < 0){
|
|
|
|
|
if (orderAmount.compareTo(new BigDecimal(1)) < 0) {
|
|
|
|
|
throw new BaseException("该工单计划数量不合法!");
|
|
|
|
|
}
|
|
|
|
|
//获取生产BOM信息
|
|
|
|
|
BaseBomInfo bomInfo = new BaseBomInfo();
|
|
|
|
|
bomInfo.setParentId(baseOrderInfo.getMaterialCode());
|
|
|
|
|
bomInfo.setAncestors(baseOrderInfo.getMaterialCode());
|
|
|
|
|
bomInfo.setIsPlanToStation(0L);
|
|
|
|
|
List<BaseBomInfo> baseBomInfoList = baseBomInfoService.selectBaseBomInfoList(bomInfo);
|
|
|
|
|
if (baseBomInfoList.size() == 0){
|
|
|
|
|
throw new BaseException("请先维护生产BOM信息!");
|
|
|
|
|
//检查生产BOM是否满足下计划条件
|
|
|
|
|
if (baseBomInfoList.size() == 0) {
|
|
|
|
|
throw new ServiceException("生产BOM信息不完整,请先维护生产BOM信息!");
|
|
|
|
|
}
|
|
|
|
|
for (BaseBomInfo baseBomInfo : baseBomInfoList) {
|
|
|
|
|
if (baseBomInfo.getMaterialType().equals(MaterialConstants.BOX_MATERIAL_TYPE)){
|
|
|
|
|
bomInfo.setIsPlanToStation(null);
|
|
|
|
|
List<BaseBomInfo> baseBomInfos= baseBomInfoService.selectBaseBomInfoList(bomInfo);
|
|
|
|
|
try {
|
|
|
|
|
for (BaseBomInfo baseBomInfo : baseBomInfos) {
|
|
|
|
|
if (baseBomInfo.getMaterialType().equals(MaterialConstants.BOX_MATERIAL_TYPE)) {
|
|
|
|
|
ProductPlanInfo planInfo = new ProductPlanInfo();
|
|
|
|
|
planInfo.setPlanCode(PlanCodeUtils.getPlanCode());
|
|
|
|
|
planInfo.setOrderCode(orderCode);
|
|
|
|
@ -156,30 +151,19 @@ public class ProductPlanInfoServiceImpl implements IProductPlanInfoService
|
|
|
|
|
planInfo.setProductLineCode("1005");
|
|
|
|
|
this.insertProductPlanInfo(planInfo);
|
|
|
|
|
|
|
|
|
|
BaseBomInfo bomInfo1 = new BaseBomInfo();
|
|
|
|
|
bomInfo1.setParentId(baseBomInfo.getMaterialCode());
|
|
|
|
|
List<BaseBomInfo> baseBomInfos = baseBomInfoService.selectBaseBomInfoList(bomInfo1);
|
|
|
|
|
for (BaseBomInfo info : baseBomInfos) {
|
|
|
|
|
if (info.getMaterialType().equals(MaterialConstants.COAMING_MATERIAL_TYPE)){
|
|
|
|
|
if (baseBomInfo.getMaterialType().equals(MaterialConstants.COAMING_MATERIAL_TYPE)) {
|
|
|
|
|
planInfo.setPlanCode(PlanCodeUtils.getPlanCode());
|
|
|
|
|
planInfo.setOrderCode(orderCode);
|
|
|
|
|
planInfo.setSaleOrderCode(saleOrderCode);
|
|
|
|
|
planInfo.setSaleorderLinenumber(saleOrderLineNumber);
|
|
|
|
|
planInfo.setMaterialCode(info.getMaterialCode());
|
|
|
|
|
planInfo.setMaterialName(info.getMaterialName());
|
|
|
|
|
planInfo.setMaterialCode(baseBomInfo.getMaterialCode());
|
|
|
|
|
planInfo.setMaterialName(baseBomInfo.getMaterialName());
|
|
|
|
|
planInfo.setProductLineCode("1001");
|
|
|
|
|
planInfo.setPlanAmount(baseBomInfo.getStandardAmount().longValue() * orderAmount.longValue());
|
|
|
|
|
this.insertProductPlanInfo(planInfo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//-- 若一个工单可下达多计划:则需要根据工单编号和物料编号去重
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//检查生产BOM是否满足下计划条件
|
|
|
|
|
// baseBomInfoService.checkBomInfo(baseBomInfoList);
|
|
|
|
|
|
|
|
|
|
baseOrderInfo.setIsRelease(0L);
|
|
|
|
|
baseOrderInfoService.updateBaseOrderInfo(baseOrderInfo);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|