update - 改生产BOM

master
yinq 10 months ago
parent d84cd4bf8f
commit 43c2e012b3

@ -24,7 +24,7 @@ import com.aucma.base.service.IOrderBomInfoService;
import com.aucma.common.utils.poi.ExcelUtil; import com.aucma.common.utils.poi.ExcelUtil;
/** /**
* BOMController * BOMController
* *
* @author Yinq * @author Yinq
* @date 2023-09-28 * @date 2023-09-28
@ -36,7 +36,7 @@ public class OrderBomInfoController extends BaseController {
private IOrderBomInfoService orderBomInfoService; private IOrderBomInfoService orderBomInfoService;
/** /**
* BOM * BOM
*/ */
@PreAuthorize("@ss.hasPermi('base:orderBomInfo:list')") @PreAuthorize("@ss.hasPermi('base:orderBomInfo:list')")
@GetMapping("/list") @GetMapping("/list")
@ -47,7 +47,7 @@ public class OrderBomInfoController extends BaseController {
} }
/** /**
* BOM * BOM
* @param orderBomInfo * @param orderBomInfo
* @return * @return
*/ */
@ -58,19 +58,19 @@ public class OrderBomInfoController extends BaseController {
} }
/** /**
* BOM * BOM
*/ */
@PreAuthorize("@ss.hasPermi('base:orderBomInfo:export')") @PreAuthorize("@ss.hasPermi('base:orderBomInfo:export')")
@Log(title = "订单BOM", businessType = BusinessType.EXPORT) @Log(title = "产品BOM", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, OrderBomInfo orderBomInfo) { public void export(HttpServletResponse response, OrderBomInfo orderBomInfo) {
List<OrderBomInfo> list = orderBomInfoService.selectOrderBomInfoList(orderBomInfo); List<OrderBomInfo> list = orderBomInfoService.selectOrderBomInfoList(orderBomInfo);
ExcelUtil<OrderBomInfo> util = new ExcelUtil<OrderBomInfo>(OrderBomInfo.class); ExcelUtil<OrderBomInfo> util = new ExcelUtil<OrderBomInfo>(OrderBomInfo.class);
util.exportExcel(response, list, "订单BOM数据"); util.exportExcel(response, list, "产品BOM数据");
} }
/** /**
* BOM * BOM
*/ */
@PreAuthorize("@ss.hasPermi('base:orderBomInfo:query')") @PreAuthorize("@ss.hasPermi('base:orderBomInfo:query')")
@GetMapping(value = "/{objId}") @GetMapping(value = "/{objId}")
@ -79,10 +79,10 @@ public class OrderBomInfoController extends BaseController {
} }
/** /**
* BOM * BOM
*/ */
@PreAuthorize("@ss.hasPermi('base:orderBomInfo:add')") @PreAuthorize("@ss.hasPermi('base:orderBomInfo:add')")
@Log(title = "订单BOM", businessType = BusinessType.INSERT) @Log(title = "产品BOM", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody OrderBomInfo orderBomInfo) { public AjaxResult add(@RequestBody OrderBomInfo orderBomInfo) {
orderBomInfo.setCreatedBy(getUsername()); orderBomInfo.setCreatedBy(getUsername());
@ -90,22 +90,21 @@ public class OrderBomInfoController extends BaseController {
} }
/** /**
* BOM * BOM
*/ */
@PreAuthorize("@ss.hasPermi('base:orderBomInfo:edit')") @PreAuthorize("@ss.hasPermi('base:orderBomInfo:edit')")
@Log(title = "订单BOM", businessType = BusinessType.UPDATE) @Log(title = "产品BOM", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody OrderBomInfo orderBomInfo) { public AjaxResult edit(@RequestBody OrderBomInfo orderBomInfo) {
orderBomInfo.setUpdatedBy(getUsername()); orderBomInfo.setUpdatedBy(getUsername());
orderBomInfo.setUpdatedTime(DateUtils.getNowDate());
return toAjax(orderBomInfoService.updateOrderBomInfo(orderBomInfo)); return toAjax(orderBomInfoService.updateOrderBomInfo(orderBomInfo));
} }
/** /**
* BOM * BOM
*/ */
@PreAuthorize("@ss.hasPermi('base:orderBomInfo:remove')") @PreAuthorize("@ss.hasPermi('base:orderBomInfo:remove')")
@Log(title = "订单BOM", businessType = BusinessType.DELETE) @Log(title = "产品BOM", businessType = BusinessType.DELETE)
@DeleteMapping("/{objIds}") @DeleteMapping("/{objIds}")
public AjaxResult remove(@PathVariable Long[] objIds) { public AjaxResult remove(@PathVariable Long[] objIds) {
return toAjax(orderBomInfoService.deleteOrderBomInfoByObjIds(objIds)); return toAjax(orderBomInfoService.deleteOrderBomInfoByObjIds(objIds));

@ -5,7 +5,7 @@ import com.aucma.base.domain.OrderBomInfo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
/** /**
* BOMMapper * BOMMapper
* *
* @author Yinq * @author Yinq
* @date 2023-09-28 * @date 2023-09-28
@ -13,55 +13,55 @@ import org.apache.ibatis.annotations.Param;
public interface OrderBomInfoMapper public interface OrderBomInfoMapper
{ {
/** /**
* BOM * BOM
* *
* @param objId BOM * @param objId BOM
* @return BOM * @return BOM
*/ */
public OrderBomInfo selectOrderBomInfoByObjId(Long objId); public OrderBomInfo selectOrderBomInfoByObjId(Long objId);
/** /**
* BOM * BOM
* *
* @param orderBomInfo BOM * @param orderBomInfo BOM
* @return BOM * @return BOM
*/ */
public List<OrderBomInfo> selectOrderBomInfoList(OrderBomInfo orderBomInfo); public List<OrderBomInfo> selectOrderBomInfoList(OrderBomInfo orderBomInfo);
/** /**
* BOM * BOM
* *
* @param orderBomInfo BOM * @param orderBomInfo BOM
* @return BOM * @return BOM
*/ */
public List<OrderBomInfo> selectFinishedProductBomInfoList(OrderBomInfo orderBomInfo); public List<OrderBomInfo> selectFinishedProductBomInfoList(OrderBomInfo orderBomInfo);
/** /**
* BOM * BOM
* *
* @param orderBomInfo BOM * @param orderBomInfo BOM
* @return * @return
*/ */
public int insertOrderBomInfo(OrderBomInfo orderBomInfo); public int insertOrderBomInfo(OrderBomInfo orderBomInfo);
/** /**
* BOM * BOM
* *
* @param orderBomInfo BOM * @param orderBomInfo BOM
* @return * @return
*/ */
public int updateOrderBomInfo(OrderBomInfo orderBomInfo); public int updateOrderBomInfo(OrderBomInfo orderBomInfo);
/** /**
* BOM * BOM
* *
* @param objId BOM * @param objId BOM
* @return * @return
*/ */
public int deleteOrderBomInfoByObjId(Long objId); public int deleteOrderBomInfoByObjId(Long objId);
/** /**
* BOM * BOM
* *
* @param objIds * @param objIds
* @return * @return
@ -87,10 +87,10 @@ public interface OrderBomInfoMapper
/** /**
* BOMBOM * BOMBOM
* *
* @param materialCode BOM * @param materialCode BOM
* @return BOM * @return BOM
*/ */
public OrderBomInfo selectOrderBomInfoByMaterialCode(@Param("materialCode") String materialCode); public OrderBomInfo selectOrderBomInfoByMaterialCode(@Param("materialCode") String materialCode);
} }

@ -4,7 +4,7 @@ import java.util.List;
import com.aucma.base.domain.OrderBomInfo; import com.aucma.base.domain.OrderBomInfo;
/** /**
* BOMService * BOMService
* *
* @author Yinq * @author Yinq
* @date 2023-09-28 * @date 2023-09-28
@ -12,50 +12,58 @@ import com.aucma.base.domain.OrderBomInfo;
public interface IOrderBomInfoService public interface IOrderBomInfoService
{ {
/** /**
* BOM * BOM
* *
* @param objId BOM * @param objId BOM
* @return BOM * @return BOM
*/ */
public OrderBomInfo selectOrderBomInfoByObjId(Long objId); public OrderBomInfo selectOrderBomInfoByObjId(Long objId);
/** /**
* BOM * BOM
* *
* @param orderBomInfo BOM * @param orderBomInfo BOM
* @return BOM * @return BOM
*/ */
public List<OrderBomInfo> selectOrderBomInfoList(OrderBomInfo orderBomInfo); public List<OrderBomInfo> selectOrderBomInfoList(OrderBomInfo orderBomInfo);
/** /**
* BOM * BOM
* *
* @param orderBomInfo BOM * @param orderBomInfo BOM
* @return * @return
*/ */
public int insertOrderBomInfo(OrderBomInfo orderBomInfo); public int insertOrderBomInfo(OrderBomInfo orderBomInfo);
/** /**
* BOM * BOM
* *
* @param orderBomInfo BOM * @param orderBomInfo BOM
* @return * @return
*/ */
public int updateOrderBomInfo(OrderBomInfo orderBomInfo); public int updateOrderBomInfo(OrderBomInfo orderBomInfo);
/** /**
* BOM * BOM
* *
* @param objIds BOM * @param objIds BOM
* @return * @return
*/ */
public int deleteOrderBomInfoByObjIds(Long[] objIds); public int deleteOrderBomInfoByObjIds(Long[] objIds);
/** /**
* BOM * BOM
* *
* @param objId BOM * @param objId BOM
* @return * @return
*/ */
public int deleteOrderBomInfoByObjId(Long objId); public int deleteOrderBomInfoByObjId(Long objId);
/**
* BOM
*
* @param materialType
* @return BOM
*/
public List<OrderBomInfo> selectOrderBomListByMaterialType(String materialType);
} }

@ -12,7 +12,7 @@ import com.aucma.base.domain.OrderBomInfo;
import com.aucma.base.service.IOrderBomInfoService; import com.aucma.base.service.IOrderBomInfoService;
/** /**
* BOMService * BOMService
* *
* @author Yinq * @author Yinq
* @date 2023-09-28 * @date 2023-09-28
@ -24,10 +24,10 @@ public class OrderBomInfoServiceImpl implements IOrderBomInfoService
private OrderBomInfoMapper orderBomInfoMapper; private OrderBomInfoMapper orderBomInfoMapper;
/** /**
* BOM * BOM
* *
* @param objId BOM * @param objId BOM
* @return BOM * @return BOM
*/ */
@Override @Override
public OrderBomInfo selectOrderBomInfoByObjId(Long objId) public OrderBomInfo selectOrderBomInfoByObjId(Long objId)
@ -36,10 +36,10 @@ public class OrderBomInfoServiceImpl implements IOrderBomInfoService
} }
/** /**
* BOM * BOM
* *
* @param orderBomInfo BOM * @param orderBomInfo BOM
* @return BOM * @return BOM
*/ */
@Override @Override
public List<OrderBomInfo> selectOrderBomInfoList(OrderBomInfo orderBomInfo) public List<OrderBomInfo> selectOrderBomInfoList(OrderBomInfo orderBomInfo)
@ -48,9 +48,9 @@ public class OrderBomInfoServiceImpl implements IOrderBomInfoService
} }
/** /**
* BOM * BOM
* *
* @param orderBomInfo BOM * @param orderBomInfo BOM
* @return * @return
*/ */
@Override @Override
@ -60,48 +60,49 @@ public class OrderBomInfoServiceImpl implements IOrderBomInfoService
// if (StringUtils.isNotNull(bomInfo)){ // if (StringUtils.isNotNull(bomInfo)){
// throw new BaseException("该物料编号:" + orderBomInfo.getMaterialCode() + "已存在!"); // throw new BaseException("该物料编号:" + orderBomInfo.getMaterialCode() + "已存在!");
// } // }
if (StringUtils.isNotNull(orderBomInfo.getParentId())){ // if (StringUtils.isNotNull(orderBomInfo.getParentId())){
OrderBomInfo info = orderBomInfoMapper.selectOrderBomInfoByMaterialCode(orderBomInfo.getParentId()); // OrderBomInfo info = orderBomInfoMapper.selectOrderBomInfoByMaterialCode(orderBomInfo.getParentId());
if (StringUtils.isNotNull(info)){ // if (StringUtils.isNotNull(info)){
orderBomInfo.setAncestors(info.getAncestors() + "," + orderBomInfo.getMaterialCode()); // orderBomInfo.setAncestors(info.getAncestors() + "," + orderBomInfo.getMaterialCode());
}else { // }else {
orderBomInfo.setAncestors(orderBomInfo.getParentId() + "," + orderBomInfo.getMaterialCode()); // orderBomInfo.setAncestors(orderBomInfo.getParentId() + "," + orderBomInfo.getMaterialCode());
} // }
}else { // }else {
orderBomInfo.setAncestors(orderBomInfo.getMaterialCode()); // orderBomInfo.setAncestors(orderBomInfo.getMaterialCode());
} // }
orderBomInfo.setCreatedTime(DateUtils.getNowDate()); orderBomInfo.setCreatedTime(DateUtils.getNowDate());
return orderBomInfoMapper.insertOrderBomInfo(orderBomInfo); return orderBomInfoMapper.insertOrderBomInfo(orderBomInfo);
} }
/** /**
* BOM * BOM
* *
* @param orderBom BOM * @param orderBom BOM
* @return * @return
*/ */
@Override @Override
public int updateOrderBomInfo(OrderBomInfo orderBom) public int updateOrderBomInfo(OrderBomInfo orderBom)
{ {
List<OrderBomInfo> orderBomInfos = orderBomInfoMapper.selectOrderBomInfoList(new OrderBomInfo()); // List<OrderBomInfo> orderBomInfos = orderBomInfoMapper.selectOrderBomInfoList(orderBom);
for (OrderBomInfo orderBomInfo : orderBomInfos) { // for (OrderBomInfo orderBomInfo : orderBomInfos) {
String parentId = orderBomInfo.getParentId(); // String parentId = orderBomInfo.getParentId();
if (StringUtils.isNull(parentId)){ // if (StringUtils.isNull(parentId)){
orderBomInfo.setAncestors(orderBomInfo.getMaterialCode()); // orderBomInfo.setAncestors(orderBomInfo.getMaterialCode());
}else { // }else {
OrderBomInfo newParentBomInfo = orderBomInfoMapper.selectOrderBomInfoByMaterialCode(parentId); // OrderBomInfo newParentBomInfo = orderBomInfoMapper.selectOrderBomInfoByMaterialCode(parentId);
OrderBomInfo oldBomInfo = orderBomInfoMapper.selectOrderBomInfoByMaterialCode(orderBomInfo.getMaterialCode()); // OrderBomInfo oldBomInfo = orderBomInfoMapper.selectOrderBomInfoByMaterialCode(orderBomInfo.getMaterialCode());
if (StringUtils.isNotNull(newParentBomInfo) && StringUtils.isNotNull(oldBomInfo)) // if (StringUtils.isNotNull(newParentBomInfo) && StringUtils.isNotNull(oldBomInfo))
{ // {
String newAncestors = newParentBomInfo.getAncestors() + "," + orderBomInfo.getMaterialCode(); // String newAncestors = newParentBomInfo.getAncestors() + "," + orderBomInfo.getMaterialCode();
String oldAncestors = oldBomInfo.getAncestors(); // String oldAncestors = oldBomInfo.getAncestors();
orderBomInfo.setAncestors(newAncestors); // orderBomInfo.setAncestors(newAncestors);
updateBomChildren(orderBomInfo.getMaterialCode(), newAncestors, oldAncestors); // updateBomChildren(orderBomInfo.getMaterialCode(), newAncestors, oldAncestors);
} // }
} // }
orderBomInfo.setUpdatedTime(DateUtils.getNowDate()); // orderBomInfo.setUpdatedTime(DateUtils.getNowDate());
orderBomInfoMapper.updateOrderBomInfo(orderBomInfo); // orderBomInfoMapper.updateOrderBomInfo(orderBomInfo);
} // }
orderBom.setUpdatedTime(DateUtils.getNowDate());
return orderBomInfoMapper.updateOrderBomInfo(orderBom); return orderBomInfoMapper.updateOrderBomInfo(orderBom);
} }
@ -125,9 +126,9 @@ public class OrderBomInfoServiceImpl implements IOrderBomInfoService
} }
/** /**
* BOM * BOM
* *
* @param objIds BOM * @param objIds BOM
* @return * @return
*/ */
@Override @Override
@ -137,9 +138,9 @@ public class OrderBomInfoServiceImpl implements IOrderBomInfoService
} }
/** /**
* BOM * BOM
* *
* @param objId BOM * @param objId BOM
* @return * @return
*/ */
@Override @Override
@ -147,4 +148,17 @@ public class OrderBomInfoServiceImpl implements IOrderBomInfoService
{ {
return orderBomInfoMapper.deleteOrderBomInfoByObjId(objId); return orderBomInfoMapper.deleteOrderBomInfoByObjId(objId);
} }
/**
* BOM
* @param materialType
* @return
*/
@Override
public List<OrderBomInfo> selectOrderBomListByMaterialType(String materialType) {
OrderBomInfo bomInfo = new OrderBomInfo();
bomInfo.setMaterialType(materialType);
return orderBomInfoMapper.selectOrderBomInfoList(bomInfo);
}
} }

@ -0,0 +1,63 @@
package com.aucma.base.utils;
/**
* @Author YinQ
* @create 2023-12-06 13:51
*/
public class MaterialConstants {
/**
*
*/
public static final String FP_MATERIAL_TYPE = "100";
/**
*
*/
public static final String BOX_MATERIAL_TYPE = "200";
/**
*
*/
public static final String DOOR_MATERIAL_TYPE = "300";
/**
*
*/
public static final String COAMING_MATERIAL_TYPE = "400";
/**
*
*/
public static final String LINER_MATERIAL_TYPE = "500";
/**
*
*/
public static final String FORMER_MATERIAL_TYPE = "600";
/**
*
*/
public static final String AFTER_MATERIAL_TYPE = "700";
/**
* SAP
*/
public static final String SAP_CP_MATERIAL = "FERT";
/**
* SAP
*/
public static final String SAP_BCP_MATERIAL = "HALB";
/**
* SAP
*/
public static final String SAP_YCL_MATERIAL = "ROH";
}

@ -84,7 +84,6 @@ public class BaseBomInfoController extends BaseController {
@PostMapping @PostMapping
public AjaxResult add(@RequestBody BaseBomInfo baseBomInfo) { public AjaxResult add(@RequestBody BaseBomInfo baseBomInfo) {
baseBomInfo.setCreatedBy(getUsername()); baseBomInfo.setCreatedBy(getUsername());
baseBomInfo.setCreatedTime(DateUtils.getNowDate());
return toAjax(baseBomInfoService.insertBaseBomInfo(baseBomInfo)); return toAjax(baseBomInfoService.insertBaseBomInfo(baseBomInfo));
} }
@ -96,7 +95,6 @@ public class BaseBomInfoController extends BaseController {
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody BaseBomInfo baseBomInfo) { public AjaxResult edit(@RequestBody BaseBomInfo baseBomInfo) {
baseBomInfo.setUpdatedBy(getUsername()); baseBomInfo.setUpdatedBy(getUsername());
baseBomInfo.setUpdatedTime(DateUtils.getNowDate());
return toAjax(baseBomInfoService.updateBaseBomInfo(baseBomInfo)); return toAjax(baseBomInfoService.updateBaseBomInfo(baseBomInfo));
} }

@ -1,5 +1,6 @@
package com.aucma.production.domain; package com.aucma.production.domain;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import com.aucma.common.core.domain.model.TreeStringEntity; import com.aucma.common.core.domain.model.TreeStringEntity;
@ -50,7 +51,7 @@ public class BaseBomInfo extends TreeStringEntity {
* *
*/ */
@Excel(name = "标准数量") @Excel(name = "标准数量")
private Long standardAmount; private BigDecimal standardAmount;
/** /**
* *
@ -200,11 +201,11 @@ public class BaseBomInfo extends TreeStringEntity {
return materialType; return materialType;
} }
public void setStandardAmount(Long standardAmount) { public void setStandardAmount(BigDecimal standardAmount) {
this.standardAmount = standardAmount; this.standardAmount = standardAmount;
} }
public Long getStandardAmount() { public BigDecimal getStandardAmount() {
return standardAmount; return standardAmount;
} }

@ -1,9 +1,13 @@
package com.aucma.production.service.impl; package com.aucma.production.service.impl;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
import com.aucma.base.domain.BaseMaterialInfo;
import com.aucma.base.domain.OrderBomInfo; import com.aucma.base.domain.OrderBomInfo;
import com.aucma.base.mapper.OrderBomInfoMapper; import com.aucma.base.mapper.BaseMaterialinfoMapper;
import com.aucma.base.service.IOrderBomInfoService;
import com.aucma.base.utils.MaterialConstants;
import com.aucma.common.exception.ServiceException; import com.aucma.common.exception.ServiceException;
import com.aucma.common.exception.base.BaseException; import com.aucma.common.exception.base.BaseException;
import com.aucma.common.utils.DateUtils; import com.aucma.common.utils.DateUtils;
@ -16,87 +20,96 @@ import com.aucma.production.service.IBaseBomInfoService;
/** /**
* BOMService * BOMService
* *
* @author Yinq * @author Yinq
* @date 2023-09-28 * @date 2023-09-28
*/ */
@Service @Service
public class BaseBomInfoServiceImpl implements IBaseBomInfoService public class BaseBomInfoServiceImpl implements IBaseBomInfoService {
{
@Autowired @Autowired
private BaseBomInfoMapper baseBomInfoMapper; private BaseBomInfoMapper baseBomInfoMapper;
@Autowired @Autowired
private OrderBomInfoMapper orderBomInfoMapper; private IOrderBomInfoService orderBomInfoService;
@Autowired
private BaseMaterialinfoMapper materialInfoMapper;
/** /**
* BOM * BOM
* *
* @param objId BOM * @param objId BOM
* @return BOM * @return BOM
*/ */
@Override @Override
public BaseBomInfo selectBaseBomInfoByObjId(Long objId) public BaseBomInfo selectBaseBomInfoByObjId(Long objId) {
{
return baseBomInfoMapper.selectBaseBomInfoByObjId(objId); return baseBomInfoMapper.selectBaseBomInfoByObjId(objId);
} }
/** /**
* BOM * BOM
* *
* @param baseBomInfo BOM * @param baseBomInfo BOM
* @return BOM * @return BOM
*/ */
@Override @Override
public List<BaseBomInfo> selectBaseBomInfoList(BaseBomInfo baseBomInfo) public List<BaseBomInfo> selectBaseBomInfoList(BaseBomInfo baseBomInfo) {
{ baseBomInfo.setMaterialCode(baseBomInfo.getMaterialCode());
return baseBomInfoMapper.selectBaseBomInfoList(baseBomInfo); baseBomInfo.setAncestors(null);
List<BaseBomInfo> baseBomInfos = baseBomInfoMapper.selectBaseBomInfoList(baseBomInfo);
return baseBomInfos;
} }
// private List<BaseBomInfo> recursionSelectBaseBomInfoList(List<BaseBomInfo> baseBomInfo) {
// return null;
//
// }
/** /**
* BOM * BOM
* *
* @param baseBomInfo BOM * @param baseBomInfo BOM
* @return * @return
*/ */
@Override @Override
public int insertBaseBomInfo(BaseBomInfo baseBomInfo) public int insertBaseBomInfo(BaseBomInfo baseBomInfo) {
{
List<BaseBomInfo> baseBomInfos = baseBomInfoMapper.selectBaseBomInfoList(baseBomInfo); List<BaseBomInfo> baseBomInfos = baseBomInfoMapper.selectBaseBomInfoList(baseBomInfo);
if (StringUtils.isNotNull(baseBomInfos)){ if (baseBomInfos.size() > 0) {
throw new BaseException("该物料编号:" + baseBomInfo.getMaterialCode() + "已存在!"); throw new BaseException("该物料编号:" + baseBomInfo.getMaterialCode() + "已存在!");
} }
if (StringUtils.isNotNull(baseBomInfo.getParentId())){ // if (StringUtils.isNotNull(baseBomInfo.getParentId())) {
BaseBomInfo info = baseBomInfoMapper.selectBaseBomInfoByMaterialCode(baseBomInfo.getParentId()); // BaseBomInfo info = baseBomInfoMapper.selectBaseBomInfoByMaterialCode(baseBomInfo.getParentId());
baseBomInfo.setAncestors(info.getAncestors() + "," + baseBomInfo.getMaterialCode()); // baseBomInfo.setAncestors(info.getAncestors() + "," + baseBomInfo.getMaterialCode());
}else { // } else {
baseBomInfo.setAncestors(baseBomInfo.getMaterialCode()); // baseBomInfo.setAncestors(baseBomInfo.getMaterialCode());
} // }
baseBomInfo.setCreatedTime(DateUtils.getNowDate());
return baseBomInfoMapper.insertBaseBomInfo(baseBomInfo); return baseBomInfoMapper.insertBaseBomInfo(baseBomInfo);
} }
/** /**
* BOM * BOM
* *
* @param baseBomInfo BOM * @param baseBomInfo BOM
* @return * @return
*/ */
@Override @Override
public int updateBaseBomInfo(BaseBomInfo baseBomInfo) public int updateBaseBomInfo(BaseBomInfo baseBomInfo) {
{ // String parentId = baseBomInfo.getParentId();
String parentId = baseBomInfo.getParentId(); // if (StringUtils.isNull(parentId)) {
if (StringUtils.isNull(parentId)){ // baseBomInfo.setAncestors(baseBomInfo.getMaterialCode());
baseBomInfo.setAncestors(baseBomInfo.getMaterialCode()); // } else {
}else { // BaseBomInfo newParentBomInfo = baseBomInfoMapper.selectBaseBomInfoByMaterialCode(parentId);
BaseBomInfo newParentBomInfo = baseBomInfoMapper.selectBaseBomInfoByMaterialCode(parentId); // BaseBomInfo oldBomInfo = baseBomInfoMapper.selectBaseBomInfoByMaterialCode(baseBomInfo.getMaterialCode());
BaseBomInfo oldBomInfo = baseBomInfoMapper.selectBaseBomInfoByMaterialCode(baseBomInfo.getMaterialCode()); // if (StringUtils.isNotNull(newParentBomInfo) && StringUtils.isNotNull(oldBomInfo)) {
if (StringUtils.isNotNull(newParentBomInfo) && StringUtils.isNotNull(oldBomInfo)) // String newAncestors = newParentBomInfo.getAncestors() + "," + baseBomInfo.getMaterialCode();
{ // String oldAncestors = oldBomInfo.getAncestors();
String newAncestors = newParentBomInfo.getAncestors() + "," + baseBomInfo.getMaterialCode(); // baseBomInfo.setAncestors(newAncestors);
String oldAncestors = oldBomInfo.getAncestors(); // updateBomChildren(baseBomInfo.getMaterialCode(), newAncestors, oldAncestors);
baseBomInfo.setAncestors(newAncestors); // }
updateBomChildren(baseBomInfo.getMaterialCode(), newAncestors, oldAncestors); // }
} baseBomInfo.setUpdatedTime(DateUtils.getNowDate());
}
return baseBomInfoMapper.updateBaseBomInfo(baseBomInfo); return baseBomInfoMapper.updateBaseBomInfo(baseBomInfo);
} }
@ -109,12 +122,10 @@ public class BaseBomInfoServiceImpl implements IBaseBomInfoService
*/ */
private void updateBomChildren(String materialCode, String newAncestors, String oldAncestors) { private void updateBomChildren(String materialCode, String newAncestors, String oldAncestors) {
List<BaseBomInfo> children = baseBomInfoMapper.selectChildrenBomById(materialCode); List<BaseBomInfo> children = baseBomInfoMapper.selectChildrenBomById(materialCode);
for (BaseBomInfo child : children) for (BaseBomInfo child : children) {
{
child.setAncestors(child.getAncestors().replaceFirst(oldAncestors, newAncestors)); child.setAncestors(child.getAncestors().replaceFirst(oldAncestors, newAncestors));
} }
if (children.size() > 0) if (children.size() > 0) {
{
baseBomInfoMapper.updateBomChildren(children); baseBomInfoMapper.updateBomChildren(children);
} }
@ -122,39 +133,35 @@ public class BaseBomInfoServiceImpl implements IBaseBomInfoService
/** /**
* BOM * BOM
* *
* @param objIds BOM * @param objIds BOM
* @return * @return
*/ */
@Override @Override
public int deleteBaseBomInfoByObjIds(Long[] objIds) public int deleteBaseBomInfoByObjIds(Long[] objIds) {
{
return baseBomInfoMapper.deleteBaseBomInfoByObjIds(objIds); return baseBomInfoMapper.deleteBaseBomInfoByObjIds(objIds);
} }
/** /**
* BOM * BOM
* *
* @param objId BOM * @param objId BOM
* @return * @return
*/ */
@Override @Override
public int deleteBaseBomInfoByObjId(Long objId) public int deleteBaseBomInfoByObjId(Long objId) {
{
return baseBomInfoMapper.deleteBaseBomInfoByObjId(objId); return baseBomInfoMapper.deleteBaseBomInfoByObjId(objId);
} }
/** /**
* BOM * BOM
*
* @param baseBomInfoList * @param baseBomInfoList
*/ */
@Override @Override
public void checkBomInfo(List<BaseBomInfo> baseBomInfoList) { public void checkBomInfo(List<BaseBomInfo> baseBomInfoList) {
for (BaseBomInfo baseBomInfo : baseBomInfoList) { for (BaseBomInfo baseBomInfo : baseBomInfoList) {
if (baseBomInfo.getStandardAmount() < 1){ if (StringUtils.isEmpty(baseBomInfo.getProductLineCode())) {
throw new ServiceException("生产BOM" + baseBomInfo.getMaterialName() + " 标准数量小于1");
}
if (StringUtils.isEmpty(baseBomInfo.getProductLineCode())){
throw new ServiceException("生产BOM" + baseBomInfo.getMaterialName() + " 未分配工位!"); throw new ServiceException("生产BOM" + baseBomInfo.getMaterialName() + " 未分配工位!");
} }
} }
@ -162,36 +169,145 @@ public class BaseBomInfoServiceImpl implements IBaseBomInfoService
/** /**
* BOM * BOM
*
* @param baseBomInfo * @param baseBomInfo
* @return * @return
*/ */
@Override @Override
public List<BaseBomInfo> addAutomaticSynchronizationBOM(BaseBomInfo baseBomInfo) { public List<BaseBomInfo> addAutomaticSynchronizationBOM(BaseBomInfo baseBomInfo) {
// 获取成品BOM // 获取成品物料
OrderBomInfo bomInfo = new OrderBomInfo(); BaseMaterialInfo materialInfo = new BaseMaterialInfo();
bomInfo.setMaterialCode("90"); materialInfo.setMaterialSubclass(MaterialConstants.FP_MATERIAL_TYPE);
List<OrderBomInfo> orderBomInfos = orderBomInfoMapper.selectFinishedProductBomInfoList(bomInfo); List<BaseMaterialInfo> baseMaterialInfos = materialInfoMapper.selectBaseMaterialInfoList(materialInfo);
// 保存成品BOM信息 // 保存成品BOM信息
for (OrderBomInfo orderBomInfo : orderBomInfos) { for (BaseMaterialInfo baseMaterialInfo : baseMaterialInfos) {
try { BaseBomInfo bomInfo = new BaseBomInfo();
bomInfo.setMaterialCode(baseMaterialInfo.getMaterialCode());
List<BaseBomInfo> baseBomInfos = baseBomInfoMapper.selectBaseBomInfoList(bomInfo);
if (StringUtils.isNull(baseBomInfos)){
BaseBomInfo info = new BaseBomInfo(); BaseBomInfo info = new BaseBomInfo();
info.setBomCode(orderBomInfo.getMaterialCode()); info.setBomCode(baseMaterialInfo.getMaterialCode());
info.setMaterialCode(orderBomInfo.getMaterialCode()); info.setMaterialCode(baseMaterialInfo.getMaterialCode());
info.setMaterialName(orderBomInfo.getMaterialName()); info.setMaterialName(baseMaterialInfo.getMaterialName());
info.setMaterialType("100"); info.setMaterialType(MaterialConstants.FP_MATERIAL_TYPE);
info.setStandardAmount(1L); info.setStandardAmount(new BigDecimal(1));
info.setPlantCode(info.getPlantCode()); info.setPlantCode(baseMaterialInfo.getPlantCode());
info.setCreatedTime(DateUtils.getNowDate()); info.setCreatedTime(DateUtils.getNowDate());
this.insertBaseBomInfo(info); try {
} catch (Exception e) { this.insertBaseBomInfo(info);
e.printStackTrace(); } catch (Exception e) {
e.printStackTrace();
}
} }
} }
// 获取子BOM信息
// 保存子成品BOM信息 for (BaseMaterialInfo baseMaterialInfo : baseMaterialInfos) {
OrderBomInfo cpPomInfo = new OrderBomInfo();
cpPomInfo.setParentId(baseMaterialInfo.getMaterialCode());
List<OrderBomInfo> orderBomInfos = orderBomInfoService.selectOrderBomInfoList(cpPomInfo);
if (orderBomInfos.size() == 0) {
continue;
}
//根据成品产品BOM存箱体、门体
for (OrderBomInfo orderBomInfo : orderBomInfos) {
//箱体
if (orderBomInfo.getMaterialType().equals(MaterialConstants.BOX_MATERIAL_TYPE)) {
this.saveBaseBomInfoByMaterialType(orderBomInfo, MaterialConstants.BOX_MATERIAL_TYPE);
}
//门体
if (orderBomInfo.getMaterialType().equals(MaterialConstants.DOOR_MATERIAL_TYPE)) {
this.saveBaseBomInfoByMaterialType(orderBomInfo, MaterialConstants.DOOR_MATERIAL_TYPE);
}
}
}
//获取箱体产品BOM信息
BaseBomInfo selectBoxBomInfo = new BaseBomInfo();
selectBoxBomInfo.setMaterialType(MaterialConstants.BOX_MATERIAL_TYPE);
List<BaseBomInfo> boxBaseBomInfoList = baseBomInfoMapper.selectBaseBomInfoList(selectBoxBomInfo);
for (BaseBomInfo boxBomInfo : boxBaseBomInfoList) {
OrderBomInfo selectBomInfo = new OrderBomInfo();
selectBomInfo.setParentId(boxBomInfo.getMaterialCode());
List<OrderBomInfo> bomInfoList = orderBomInfoService.selectOrderBomInfoList(selectBomInfo);
//Boolean flag = false; // 判断BOM是否含有预装箱体
for (OrderBomInfo orderBomInfo : bomInfoList) {
//内胆
if (orderBomInfo.getMaterialType().equals(MaterialConstants.LINER_MATERIAL_TYPE)) {
this.saveBaseBomInfoByMaterialType(orderBomInfo, MaterialConstants.LINER_MATERIAL_TYPE);
}
//围板
if (orderBomInfo.getMaterialType().equals(MaterialConstants.COAMING_MATERIAL_TYPE)) {
this.saveBaseBomInfoByMaterialType(orderBomInfo, MaterialConstants.COAMING_MATERIAL_TYPE);
}
}
}
//获取围板产品BOM信息
BaseBomInfo selectWBomInfo = new BaseBomInfo();
selectWBomInfo.setMaterialType(MaterialConstants.COAMING_MATERIAL_TYPE);
List<BaseBomInfo> boxBaseWBomInfoList = baseBomInfoMapper.selectBaseBomInfoList(selectWBomInfo);
for (BaseBomInfo boxBomInfo : boxBaseWBomInfoList) {
OrderBomInfo selectBomInfo = new OrderBomInfo();
selectBomInfo.setParentId(boxBomInfo.getMaterialCode());
List<OrderBomInfo> bomInfoList = orderBomInfoService.selectOrderBomInfoList(selectBomInfo);
for (OrderBomInfo orderBomInfo : bomInfoList) {
//前板
if (orderBomInfo.getMaterialType().equals(MaterialConstants.FORMER_MATERIAL_TYPE)) {
this.saveBaseBomInfoByMaterialType(orderBomInfo, MaterialConstants.FORMER_MATERIAL_TYPE);
}
//后板
if (orderBomInfo.getMaterialType().equals(MaterialConstants.AFTER_MATERIAL_TYPE)) {
this.saveBaseBomInfoByMaterialType(orderBomInfo, MaterialConstants.AFTER_MATERIAL_TYPE);
}
}
}
return null; return null;
} }
/**
* BOM
*
* @param orderBomInfo
* @param materialType
*/
private void saveBaseBomInfoByMaterialType(OrderBomInfo orderBomInfo, String materialType) {
List<BaseBomInfo> baseBomInfos = this.checkDuplicateBaseBom(orderBomInfo);
if (baseBomInfos.size() > 0) {
// 排除异常情况生产BOM信息重复
return;
}
// 保存BOM信息
BaseBomInfo info = new BaseBomInfo();
info.setBomCode(orderBomInfo.getMaterialCode());
info.setMaterialCode(orderBomInfo.getMaterialCode());
info.setMaterialName(orderBomInfo.getMaterialName());
info.setMaterialType(materialType);
info.setParentId(orderBomInfo.getParentId());
info.setStandardAmount(orderBomInfo.getStandardAmount());
info.setPlantCode(orderBomInfo.getFactoryCode());
try {
info.setCreatedTime(DateUtils.getNowDate());
baseBomInfoMapper.insertBaseBomInfo(info);
} catch (Exception e) {
System.out.println("+++++根据物料类型存生产BOM异常++++" + e);
;
}
}
/**
* BOM
*
* @param bomInfo
* @return
*/
private List<BaseBomInfo> checkDuplicateBaseBom(OrderBomInfo bomInfo) {
BaseBomInfo baseBomOne = new BaseBomInfo();
baseBomOne.setMaterialCode(bomInfo.getMaterialCode());
baseBomOne.setParentId(bomInfo.getParentId());
baseBomOne.setPlantCode(bomInfo.getFactoryCode());
return baseBomInfoMapper.selectBaseBomInfoList(baseBomOne);
}
} }

@ -53,7 +53,7 @@
<include refid="selectBaseBomInfoVo"/> <include refid="selectBaseBomInfoVo"/>
<where> <where>
<if test="bomCode != null and bomCode != ''">and bb.bom_code = #{bomCode}</if> <if test="bomCode != null and bomCode != ''">and bb.bom_code = #{bomCode}</if>
<if test="materialCode != null and materialCode != ''">and bb.material_code like concat(#{material_code}, '%')</if> <if test="materialCode != null and materialCode != ''">and bb.material_code like concat(#{materialCode}, '%')</if>
<if test="materialName != null and materialName != ''">and bb.material_name like concat(concat('%',#{materialName}), '%') <if test="materialName != null and materialName != ''">and bb.material_name like concat(concat('%',#{materialName}), '%')
</if> </if>
<if test="materialType != null and materialType != ''">and bb.material_type = #{materialType}</if> <if test="materialType != null and materialType != ''">and bb.material_type = #{materialType}</if>

@ -5,116 +5,142 @@
<mapper namespace="com.aucma.production.mapper.CalendarInfoMapper"> <mapper namespace="com.aucma.production.mapper.CalendarInfoMapper">
<resultMap type="CalendarInfo" id="CalendarInfoResult"> <resultMap type="CalendarInfo" id="CalendarInfoResult">
<result property="objId" column="obj_id" /> <result property="objId" column="obj_id"/>
<result property="sapPlanCode" column="sap_plan_code" /> <result property="sapPlanCode" column="sap_plan_code"/>
<result property="materialCode" column="material_code" /> <result property="materialCode" column="material_code"/>
<result property="materialName" column="material_name" /> <result property="materialName" column="material_name"/>
<result property="planStartDate" column="plan_start_date" /> <result property="planStartDate" column="plan_start_date"/>
<result property="planEndDate" column="plan_end_date" /> <result property="planEndDate" column="plan_end_date"/>
<result property="planAmount" column="plan_amount" /> <result property="planAmount" column="plan_amount"/>
<result property="schedulingDate" column="scheduling_date" /> <result property="schedulingDate" column="scheduling_date"/>
<result property="isScheduling" column="is_scheduling" /> <result property="isScheduling" column="is_scheduling"/>
<result property="schedulingTeam" column="scheduling_team" /> <result property="schedulingTeam" column="scheduling_team"/>
<result property="isFlag" column="is_flag" /> <result property="isFlag" column="is_flag"/>
<result property="createdBy" column="created_by" /> <result property="createdBy" column="created_by"/>
<result property="createdTime" column="created_time" /> <result property="createdTime" column="created_time"/>
<result property="updatedBy" column="updated_by" /> <result property="updatedBy" column="updated_by"/>
<result property="updatedTime" column="updated_time" /> <result property="updatedTime" column="updated_time"/>
</resultMap> </resultMap>
<sql id="selectCalendarInfoVo"> <sql id="selectCalendarInfoVo">
select obj_id, sap_plan_code, material_code, material_name, plan_start_date, plan_end_date, plan_amount, scheduling_date, is_scheduling, scheduling_team, is_flag, created_by, created_time, updated_by, updated_time from product_calendar_info select obj_id,
sap_plan_code,
material_code,
material_name,
plan_start_date,
plan_end_date,
plan_amount,
scheduling_date,
is_scheduling,
scheduling_team,
is_flag,
created_by,
created_time,
updated_by,
updated_time
from product_calendar_info
</sql> </sql>
<select id="selectCalendarInfoList" parameterType="CalendarInfo" resultMap="CalendarInfoResult"> <select id="selectCalendarInfoList" parameterType="CalendarInfo" resultMap="CalendarInfoResult">
<include refid="selectCalendarInfoVo"/> <include refid="selectCalendarInfoVo"/>
<where> <where>
<if test="sapPlanCode != null and sapPlanCode != ''"> and sap_plan_code = #{sapPlanCode}</if> material_code like concat('90', '%')
<if test="materialCode != null and materialCode != ''"> and material_code = #{materialCode}</if> <if test="sapPlanCode != null and sapPlanCode != ''">and sap_plan_code = #{sapPlanCode}</if>
<if test="materialName != null and materialName != ''"> and material_name like concat(concat('%', #{materialName}), '%')</if> <if test="materialCode != null and materialCode != ''">and material_code = #{materialCode}</if>
<if test="params.beginPlanStartDate != null and params.beginPlanStartDate != '' and params.endPlanStartDate != null and params.endPlanStartDate != ''"> and plan_start_date between to_date(#{params.beginPlanStartDate}, 'yyyy-mm-dd hh24:mi:ss') and to_date(#{params.endPlanStartDate}, 'yyyy-mm-dd hh24:mi:ss')</if> <if test="materialName != null and materialName != ''">and material_name like concat(concat('%',
<if test="planEndDate != null "> and plan_end_date = #{planEndDate}</if> #{materialName}), '%')
<if test="planAmount != null "> and plan_amount = #{planAmount}</if> </if>
<if test="params.beginSchedulingDate != null and params.beginSchedulingDate != '' and params.endSchedulingDate != null and params.endSchedulingDate != ''"> and scheduling_date between to_date(#{params.beginSchedulingDate}, 'yyyy-mm-dd hh24:mi:ss') and to_date(#{params.endSchedulingDate}, 'yyyy-mm-dd hh24:mi:ss')</if> <if test="params.beginPlanStartDate != null and params.beginPlanStartDate != '' and params.endPlanStartDate != null and params.endPlanStartDate != ''">
<if test="isScheduling != null "> and is_scheduling = #{isScheduling}</if> and plan_start_date between to_date(#{params.beginPlanStartDate}, 'yyyy-mm-dd hh24:mi:ss') and
<if test="schedulingTeam != null and schedulingTeam != ''"> and scheduling_team = #{schedulingTeam}</if> to_date(#{params.endPlanStartDate}, 'yyyy-mm-dd hh24:mi:ss')
<if test="isFlag != null "> and is_flag = #{isFlag}</if> </if>
<if test="createdBy != null and createdBy != ''"> and created_by = #{createdBy}</if> <if test="planEndDate != null ">and plan_end_date = #{planEndDate}</if>
<if test="createdTime != null "> and created_time = #{createdTime}</if> <if test="planAmount != null ">and plan_amount = #{planAmount}</if>
<if test="updatedBy != null and updatedBy != ''"> and updated_by = #{updatedBy}</if> <if test="params.beginSchedulingDate != null and params.beginSchedulingDate != '' and params.endSchedulingDate != null and params.endSchedulingDate != ''">
<if test="updatedTime != null "> and updated_time = #{updatedTime}</if> and scheduling_date between to_date(#{params.beginSchedulingDate}, 'yyyy-mm-dd hh24:mi:ss') and
to_date(#{params.endSchedulingDate}, 'yyyy-mm-dd hh24:mi:ss')
</if>
<if test="isScheduling != null ">and is_scheduling = #{isScheduling}</if>
<if test="schedulingTeam != null and schedulingTeam != ''">and scheduling_team = #{schedulingTeam}</if>
<if test="isFlag != null ">and is_flag = #{isFlag}</if>
<if test="createdBy != null and createdBy != ''">and created_by = #{createdBy}</if>
<if test="createdTime != null ">and created_time = #{createdTime}</if>
<if test="updatedBy != null and updatedBy != ''">and updated_by = #{updatedBy}</if>
<if test="updatedTime != null ">and updated_time = #{updatedTime}</if>
</where> </where>
</select> </select>
<select id="selectCalendarInfoByObjId" parameterType="Long" resultMap="CalendarInfoResult"> <select id="selectCalendarInfoByObjId" parameterType="Long" resultMap="CalendarInfoResult">
<include refid="selectCalendarInfoVo"/> <include refid="selectCalendarInfoVo"/>
where obj_id = #{objId} where obj_id = #{objId}
</select> </select>
<insert id="insertCalendarInfo" parameterType="CalendarInfo"> <insert id="insertCalendarInfo" parameterType="CalendarInfo">
<selectKey keyProperty="objId" resultType="long" order="BEFORE"> <selectKey keyProperty="objId" resultType="long" order="BEFORE">
SELECT seq_product_calendar_info.NEXTVAL as objId FROM DUAL SELECT seq_product_calendar_info.NEXTVAL as objId FROM DUAL
</selectKey> </selectKey>
insert into product_calendar_info insert into product_calendar_info
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="objId != null">obj_id,</if> <if test="objId != null">obj_id,</if>
<if test="sapPlanCode != null">sap_plan_code,</if> <if test="sapPlanCode != null">sap_plan_code,</if>
<if test="materialCode != null">material_code,</if> <if test="materialCode != null">material_code,</if>
<if test="materialName != null">material_name,</if> <if test="materialName != null">material_name,</if>
<if test="planStartDate != null">plan_start_date,</if> <if test="planStartDate != null">plan_start_date,</if>
<if test="planEndDate != null">plan_end_date,</if> <if test="planEndDate != null">plan_end_date,</if>
<if test="planAmount != null">plan_amount,</if> <if test="planAmount != null">plan_amount,</if>
<if test="schedulingDate != null">scheduling_date,</if> <if test="schedulingDate != null">scheduling_date,</if>
<if test="isScheduling != null">is_scheduling,</if> <if test="isScheduling != null">is_scheduling,</if>
<if test="schedulingTeam != null">scheduling_team,</if> <if test="schedulingTeam != null">scheduling_team,</if>
<if test="isFlag != null">is_flag,</if> <if test="isFlag != null">is_flag,</if>
<if test="createdBy != null">created_by,</if> <if test="createdBy != null">created_by,</if>
<if test="createdTime != null">created_time,</if> <if test="createdTime != null">created_time,</if>
<if test="updatedBy != null">updated_by,</if> <if test="updatedBy != null">updated_by,</if>
<if test="updatedTime != null">updated_time,</if> <if test="updatedTime != null">updated_time,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="objId != null">#{objId},</if> <if test="objId != null">#{objId},</if>
<if test="sapPlanCode != null">#{sapPlanCode},</if> <if test="sapPlanCode != null">#{sapPlanCode},</if>
<if test="materialCode != null">#{materialCode},</if> <if test="materialCode != null">#{materialCode},</if>
<if test="materialName != null">#{materialName,jdbcType=NVARCHAR},</if> <if test="materialName != null">#{materialName,jdbcType=NVARCHAR},</if>
<if test="planStartDate != null">#{planStartDate},</if> <if test="planStartDate != null">#{planStartDate},</if>
<if test="planEndDate != null">#{planEndDate},</if> <if test="planEndDate != null">#{planEndDate},</if>
<if test="planAmount != null">#{planAmount},</if> <if test="planAmount != null">#{planAmount},</if>
<if test="schedulingDate != null">#{schedulingDate},</if> <if test="schedulingDate != null">#{schedulingDate},</if>
<if test="isScheduling != null">#{isScheduling},</if> <if test="isScheduling != null">#{isScheduling},</if>
<if test="schedulingTeam != null">#{schedulingTeam},</if> <if test="schedulingTeam != null">#{schedulingTeam},</if>
<if test="isFlag != null">#{isFlag},</if> <if test="isFlag != null">#{isFlag},</if>
<if test="createdBy != null">#{createdBy},</if> <if test="createdBy != null">#{createdBy},</if>
<if test="createdTime != null">#{createdTime},</if> <if test="createdTime != null">#{createdTime},</if>
<if test="updatedBy != null">#{updatedBy},</if> <if test="updatedBy != null">#{updatedBy},</if>
<if test="updatedTime != null">#{updatedTime},</if> <if test="updatedTime != null">#{updatedTime},</if>
</trim> </trim>
</insert> </insert>
<update id="updateCalendarInfo" parameterType="CalendarInfo"> <update id="updateCalendarInfo" parameterType="CalendarInfo">
update product_calendar_info update product_calendar_info
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="sapPlanCode != null">sap_plan_code = #{sapPlanCode},</if> <if test="sapPlanCode != null">sap_plan_code = #{sapPlanCode},</if>
<if test="materialCode != null">material_code = #{materialCode},</if> <if test="materialCode != null">material_code = #{materialCode},</if>
<if test="materialName != null">material_name = #{materialName,jdbcType=NVARCHAR},</if> <if test="materialName != null">material_name = #{materialName,jdbcType=NVARCHAR},</if>
<if test="planStartDate != null">plan_start_date = #{planStartDate},</if> <if test="planStartDate != null">plan_start_date = #{planStartDate},</if>
<if test="planEndDate != null">plan_end_date = #{planEndDate},</if> <if test="planEndDate != null">plan_end_date = #{planEndDate},</if>
<if test="planAmount != null">plan_amount = #{planAmount},</if> <if test="planAmount != null">plan_amount = #{planAmount},</if>
<if test="schedulingDate != null">scheduling_date = #{schedulingDate},</if> <if test="schedulingDate != null">scheduling_date = #{schedulingDate},</if>
<if test="isScheduling != null">is_scheduling = #{isScheduling},</if> <if test="isScheduling != null">is_scheduling = #{isScheduling},</if>
<if test="schedulingTeam != null">scheduling_team = #{schedulingTeam},</if> <if test="schedulingTeam != null">scheduling_team = #{schedulingTeam},</if>
<if test="isFlag != null">is_flag = #{isFlag},</if> <if test="isFlag != null">is_flag = #{isFlag},</if>
<if test="createdBy != null">created_by = #{createdBy},</if> <if test="createdBy != null">created_by = #{createdBy},</if>
<if test="createdTime != null">created_time = #{createdTime},</if> <if test="createdTime != null">created_time = #{createdTime},</if>
<if test="updatedBy != null">updated_by = #{updatedBy},</if> <if test="updatedBy != null">updated_by = #{updatedBy},</if>
<if test="updatedTime != null">updated_time = #{updatedTime},</if> <if test="updatedTime != null">updated_time = #{updatedTime},</if>
</trim> </trim>
where obj_id = #{objId} where obj_id = #{objId}
</update> </update>
<delete id="deleteCalendarInfoByObjId" parameterType="Long"> <delete id="deleteCalendarInfoByObjId" parameterType="Long">
delete from product_calendar_info where obj_id = #{objId} delete
from product_calendar_info
where obj_id = #{objId}
</delete> </delete>
<delete id="deleteCalendarInfoByObjIds" parameterType="String"> <delete id="deleteCalendarInfoByObjIds" parameterType="String">

Loading…
Cancel
Save