diff --git a/os-common/src/main/java/com/os/common/utils/uuid/PlanCodeUtils.java b/os-common/src/main/java/com/os/common/utils/uuid/PlanCodeUtils.java new file mode 100644 index 0000000..53f30b4 --- /dev/null +++ b/os-common/src/main/java/com/os/common/utils/uuid/PlanCodeUtils.java @@ -0,0 +1,57 @@ +package com.os.common.utils.uuid; + +import com.os.common.core.redis.RedisCache; +import com.os.common.utils.spring.SpringUtils; +import org.springframework.stereotype.Component; + +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.Calendar; +import java.util.concurrent.TimeUnit; + +/** + * @ClassName : PlanCodeUtils + * @Description : zhouhy + * @Author :生产计划-计划编号生成 + * @Date: 2023-10-07 09:46 + */ +@Component +public class PlanCodeUtils { + + + public static String getPlanCode() { + LocalDate date = LocalDate.now(); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyMMdd"); + String format = "plan_code:" + date.format(formatter); + //以当日日期作为key + if (!SpringUtils.getBean(RedisCache.class).hasKey(format)) { + SpringUtils.getBean(RedisCache.class).setCacheObject(format, 1); + SpringUtils.getBean(RedisCache.class).expire(format, getSecondsNextEarlyMorning(), TimeUnit.SECONDS); + } else { + //获取当前的value在+1 + Object cacheObject = SpringUtils.getBean(RedisCache.class).getCacheObject(format); + String value = String.valueOf(cacheObject); + Integer integer = Integer.parseInt(value) + 1; + SpringUtils.getBean(RedisCache.class).setCacheObject(format, integer); + SpringUtils.getBean(RedisCache.class).expire(format, getSecondsNextEarlyMorning(), TimeUnit.SECONDS); + } + Object cacheObject = SpringUtils.getBean(RedisCache.class).getCacheObject(format); + //转成string在转成int + String code = String.format("%04d", Integer.valueOf(String.valueOf(cacheObject))); + + return date.format(formatter) + code; + } + + //判断当前时间距离第二天0点时间的秒数 + public static Long getSecondsNextEarlyMorning() { + Calendar cal = Calendar.getInstance(); + cal.add(Calendar.DAY_OF_YEAR, 1); + cal.set(Calendar.HOUR_OF_DAY, 0); + cal.set(Calendar.SECOND, 0); + cal.set(Calendar.MINUTE, 0); + cal.set(Calendar.MILLISECOND, 0); + return (cal.getTimeInMillis() - System.currentTimeMillis()) / 1000; + } + + +} diff --git a/os-mes/src/main/java/com/os/mes/prod/controller/ProdBomInfoController.java b/os-mes/src/main/java/com/os/mes/prod/controller/ProdBomInfoController.java index 8d55ae6..58aaee9 100644 --- a/os-mes/src/main/java/com/os/mes/prod/controller/ProdBomInfoController.java +++ b/os-mes/src/main/java/com/os/mes/prod/controller/ProdBomInfoController.java @@ -115,4 +115,13 @@ public class ProdBomInfoController extends BaseController { public AjaxResult remove(@PathVariable Long[] objIds) { return toAjax(prodBomInfoService.deleteProdBomInfoByObjIds(objIds)); } + + /** + * 通过生产BOM生成工单 + */ + @GetMapping("/generateTickets") + public AjaxResult generateTickets(ProdBomInfo prodBomInfo) { + List list = prodBomInfoService.generateTickets(prodBomInfo); + return success(list); + } } diff --git a/os-mes/src/main/java/com/os/mes/prod/controller/ProdPlanInfoController.java b/os-mes/src/main/java/com/os/mes/prod/controller/ProdPlanInfoController.java new file mode 100644 index 0000000..4b39b0b --- /dev/null +++ b/os-mes/src/main/java/com/os/mes/prod/controller/ProdPlanInfoController.java @@ -0,0 +1,111 @@ +package com.os.mes.prod.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.os.common.annotation.Log; +import com.os.common.core.controller.BaseController; +import com.os.common.core.domain.AjaxResult; +import com.os.common.enums.BusinessType; +import com.os.mes.prod.domain.ProdPlanInfo; +import com.os.mes.prod.service.IProdPlanInfoService; +import com.os.common.utils.poi.ExcelUtil; +import com.os.common.core.page.TableDataInfo; + +/** + * 生产工单Controller + * + * @author Yinq + * @date 2024-06-03 + */ +@RestController +@RequestMapping("/mes/prod/prodPlanInfo") +public class ProdPlanInfoController extends BaseController { + @Autowired + private IProdPlanInfoService prodPlanInfoService; + + /** + * 查询生产工单列表 + */ + @PreAuthorize("@ss.hasPermi('mes/prod:prodPlanInfo:list')") + @GetMapping("/list") + public TableDataInfo list(ProdPlanInfo prodPlanInfo) { + startPage(); + List list = prodPlanInfoService.selectProdPlanInfoList(prodPlanInfo); + return getDataTable(list); + } + + /** + * 导出生产工单列表 + */ + @PreAuthorize("@ss.hasPermi('mes/prod:prodPlanInfo:export')") + @Log(title = "生产工单", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ProdPlanInfo prodPlanInfo) { + List list = prodPlanInfoService.selectProdPlanInfoList(prodPlanInfo); + ExcelUtil util = new ExcelUtil(ProdPlanInfo.class); + util.exportExcel(response, list, "生产工单数据"); + } + + /** + * 获取生产工单详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes/prod:prodPlanInfo:query')") + @GetMapping(value = "/{objId}") + public AjaxResult getInfo(@PathVariable("objId") Long objId) { + return success(prodPlanInfoService.selectProdPlanInfoByObjId(objId)); + } + + /** + * 新增生产工单 + */ + @PreAuthorize("@ss.hasPermi('mes/prod:prodPlanInfo:add')") + @Log(title = "生产工单", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ProdPlanInfo prodPlanInfo) { + prodPlanInfo.setCreateBy(getUsername()); + return toAjax(prodPlanInfoService.insertProdPlanInfo(prodPlanInfo)); + } + + /** + * 修改生产工单 + */ + @PreAuthorize("@ss.hasPermi('mes/prod:prodPlanInfo:edit')") + @Log(title = "生产工单", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ProdPlanInfo prodPlanInfo) { + prodPlanInfo.setUpdateBy(getUsername()); + return toAjax(prodPlanInfoService.updateProdPlanInfo(prodPlanInfo)); + } + + /** + * 删除生产工单 + */ + @PreAuthorize("@ss.hasPermi('mes/prod:prodPlanInfo:remove')") + @Log(title = "生产工单", businessType = BusinessType.DELETE) + @DeleteMapping("/{objIds}") + public AjaxResult remove(@PathVariable Long[] objIds) { + return toAjax(prodPlanInfoService.deleteProdPlanInfoByObjIds(objIds)); + } + + /** + * 订单新增生产工单List + * @param prodPlanInfos + * @return + */ + @PostMapping("/orderAddProdPlanInfoList") + public AjaxResult orderAddProdPlanInfoList(@RequestBody List prodPlanInfos) { + return toAjax(prodPlanInfoService.orderAddProdPlanInfoList(prodPlanInfos)); + } + +} diff --git a/os-mes/src/main/java/com/os/mes/prod/domain/ProdBomInfo.java b/os-mes/src/main/java/com/os/mes/prod/domain/ProdBomInfo.java index d606a02..f2cee21 100644 --- a/os-mes/src/main/java/com/os/mes/prod/domain/ProdBomInfo.java +++ b/os-mes/src/main/java/com/os/mes/prod/domain/ProdBomInfo.java @@ -129,6 +129,16 @@ public class ProdBomInfo extends BaseEntity { @Excel(name = "BOM全称") private String materialAll; + private String planCode; + + public String getPlanCode() { + return planCode; + } + + public void setPlanCode(String planCode) { + this.planCode = planCode; + } + public String getMaterialAll() { return materialAll; } diff --git a/os-mes/src/main/java/com/os/mes/prod/domain/ProdPlanInfo.java b/os-mes/src/main/java/com/os/mes/prod/domain/ProdPlanInfo.java new file mode 100644 index 0000000..8fbf904 --- /dev/null +++ b/os-mes/src/main/java/com/os/mes/prod/domain/ProdPlanInfo.java @@ -0,0 +1,315 @@ +package com.os.mes.prod.domain; + +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.os.common.annotation.Excel; +import com.os.common.core.domain.BaseEntity; + +/** + * 生产工单对象 prod_plan_info + * + * @author Yinq + * @date 2024-06-03 + */ +public class ProdPlanInfo extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * 主键标识 + */ + private Long objId; + + /** + * 工单编号 + */ + @Excel(name = "工单编号") + private String planCode; + + /** + * 订单编号 + */ + @Excel(name = "订单编号") + private String orderCode; + + /** + * 物料编号 + */ + @Excel(name = "物料编号") + private String materialCode; + + /** + * 物料名称 + */ + @Excel(name = "物料名称") + private String materialName; + + /** + * 计划工位 + */ + @Excel(name = "计划工位") + private String stationCode; + + /** + * 设备编号 + */ + @Excel(name = "设备编号") + private String deviceCode; + + /** + * 计划班组 + */ + @Excel(name = "计划班组") + private String teamCode; + + /** + * 计划数量 + */ + @Excel(name = "计划数量") + private Long planAmount; + + /** + * 完成数量 + */ + @Excel(name = "完成数量") + private Long completeAmount; + + /** + * 实际开始时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "实际开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date beginTime; + + /** + * 实际完成时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "实际完成时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date endTime; + + /** + * 完成标识(0=正常,1=降级,2=超额) + */ + @Excel(name = "完成标识", readConverterExp = "0==正常,1=降级,2=超额") + private String compFlag; + + /** + * 创建人 + */ + @Excel(name = "创建人") + private String createdBy; + + /** + * 创建时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date createdTime; + + /** + * 更新人 + */ + @Excel(name = "更新人") + private String updatedBy; + + /** + * 更新时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date updatedTime; + + /** + * 计划开始时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "计划开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date planBeginTime; + + /** + * 计划结束时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "计划结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date planEndTime; + + public void setObjId(Long objId) { + this.objId = objId; + } + + public Long getObjId() { + return objId; + } + + public void setPlanCode(String planCode) { + this.planCode = planCode; + } + + public String getPlanCode() { + return planCode; + } + + public void setOrderCode(String orderCode) { + this.orderCode = orderCode; + } + + public String getOrderCode() { + return orderCode; + } + + public void setMaterialCode(String materialCode) { + this.materialCode = materialCode; + } + + public String getMaterialCode() { + return materialCode; + } + + public void setMaterialName(String materialName) { + this.materialName = materialName; + } + + public String getMaterialName() { + return materialName; + } + + public void setStationCode(String stationCode) { + this.stationCode = stationCode; + } + + public String getStationCode() { + return stationCode; + } + + public void setDeviceCode(String deviceCode) { + this.deviceCode = deviceCode; + } + + public String getDeviceCode() { + return deviceCode; + } + + public void setTeamCode(String teamCode) { + this.teamCode = teamCode; + } + + public String getTeamCode() { + return teamCode; + } + + public void setPlanAmount(Long planAmount) { + this.planAmount = planAmount; + } + + public Long getPlanAmount() { + return planAmount; + } + + public void setCompleteAmount(Long completeAmount) { + this.completeAmount = completeAmount; + } + + public Long getCompleteAmount() { + return completeAmount; + } + + public void setBeginTime(Date beginTime) { + this.beginTime = beginTime; + } + + public Date getBeginTime() { + return beginTime; + } + + public void setEndTime(Date endTime) { + this.endTime = endTime; + } + + public Date getEndTime() { + return endTime; + } + + public void setCompFlag(String compFlag) { + this.compFlag = compFlag; + } + + public String getCompFlag() { + return compFlag; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedTime(Date createdTime) { + this.createdTime = createdTime; + } + + public Date getCreatedTime() { + return createdTime; + } + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + public String getUpdatedBy() { + return updatedBy; + } + + public void setUpdatedTime(Date updatedTime) { + this.updatedTime = updatedTime; + } + + public Date getUpdatedTime() { + return updatedTime; + } + + public void setPlanBeginTime(Date planBeginTime) { + this.planBeginTime = planBeginTime; + } + + public Date getPlanBeginTime() { + return planBeginTime; + } + + public void setPlanEndTime(Date planEndTime) { + this.planEndTime = planEndTime; + } + + public Date getPlanEndTime() { + return planEndTime; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("objId", getObjId()) + .append("planCode", getPlanCode()) + .append("orderCode", getOrderCode()) + .append("materialCode", getMaterialCode()) + .append("materialName", getMaterialName()) + .append("stationCode", getStationCode()) + .append("deviceCode", getDeviceCode()) + .append("teamCode", getTeamCode()) + .append("planAmount", getPlanAmount()) + .append("completeAmount", getCompleteAmount()) + .append("beginTime", getBeginTime()) + .append("endTime", getEndTime()) + .append("compFlag", getCompFlag()) + .append("createdBy", getCreatedBy()) + .append("createdTime", getCreatedTime()) + .append("updatedBy", getUpdatedBy()) + .append("updatedTime", getUpdatedTime()) + .append("planBeginTime", getPlanBeginTime()) + .append("planEndTime", getPlanEndTime()) + .toString(); + } +} diff --git a/os-mes/src/main/java/com/os/mes/prod/mapper/ProdPlanInfoMapper.java b/os-mes/src/main/java/com/os/mes/prod/mapper/ProdPlanInfoMapper.java new file mode 100644 index 0000000..64da7a4 --- /dev/null +++ b/os-mes/src/main/java/com/os/mes/prod/mapper/ProdPlanInfoMapper.java @@ -0,0 +1,61 @@ +package com.os.mes.prod.mapper; + +import java.util.List; + +import com.os.mes.prod.domain.ProdPlanInfo; + +/** + * 生产工单Mapper接口 + * + * @author Yinq + * @date 2024-06-03 + */ +public interface ProdPlanInfoMapper { + /** + * 查询生产工单 + * + * @param objId 生产工单主键 + * @return 生产工单 + */ + public ProdPlanInfo selectProdPlanInfoByObjId(Long objId); + + /** + * 查询生产工单列表 + * + * @param prodPlanInfo 生产工单 + * @return 生产工单集合 + */ + public List selectProdPlanInfoList(ProdPlanInfo prodPlanInfo); + + /** + * 新增生产工单 + * + * @param prodPlanInfo 生产工单 + * @return 结果 + */ + public int insertProdPlanInfo(ProdPlanInfo prodPlanInfo); + + /** + * 修改生产工单 + * + * @param prodPlanInfo 生产工单 + * @return 结果 + */ + public int updateProdPlanInfo(ProdPlanInfo prodPlanInfo); + + /** + * 删除生产工单 + * + * @param objId 生产工单主键 + * @return 结果 + */ + public int deleteProdPlanInfoByObjId(Long objId); + + /** + * 批量删除生产工单 + * + * @param objIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteProdPlanInfoByObjIds(Long[] objIds); +} diff --git a/os-mes/src/main/java/com/os/mes/prod/service/IProdBomInfoService.java b/os-mes/src/main/java/com/os/mes/prod/service/IProdBomInfoService.java index 6892afd..6f60d31 100644 --- a/os-mes/src/main/java/com/os/mes/prod/service/IProdBomInfoService.java +++ b/os-mes/src/main/java/com/os/mes/prod/service/IProdBomInfoService.java @@ -65,4 +65,11 @@ public interface IProdBomInfoService { * @return */ List selectProductionBomTreeList(ProdBomInfo prodBomInfo); + + /** + * 通过生产BOM生成工单 + * @param prodBomInfo + * @return + */ + List generateTickets(ProdBomInfo prodBomInfo); } diff --git a/os-mes/src/main/java/com/os/mes/prod/service/IProdPlanInfoService.java b/os-mes/src/main/java/com/os/mes/prod/service/IProdPlanInfoService.java new file mode 100644 index 0000000..b903f11 --- /dev/null +++ b/os-mes/src/main/java/com/os/mes/prod/service/IProdPlanInfoService.java @@ -0,0 +1,68 @@ +package com.os.mes.prod.service; + +import java.util.List; + +import com.os.mes.prod.domain.ProdPlanInfo; + +/** + * 生产工单Service接口 + * + * @author Yinq + * @date 2024-06-03 + */ +public interface IProdPlanInfoService { + /** + * 查询生产工单 + * + * @param objId 生产工单主键 + * @return 生产工单 + */ + public ProdPlanInfo selectProdPlanInfoByObjId(Long objId); + + /** + * 查询生产工单列表 + * + * @param prodPlanInfo 生产工单 + * @return 生产工单集合 + */ + public List selectProdPlanInfoList(ProdPlanInfo prodPlanInfo); + + /** + * 新增生产工单 + * + * @param prodPlanInfo 生产工单 + * @return 结果 + */ + public int insertProdPlanInfo(ProdPlanInfo prodPlanInfo); + + /** + * 修改生产工单 + * + * @param prodPlanInfo 生产工单 + * @return 结果 + */ + public int updateProdPlanInfo(ProdPlanInfo prodPlanInfo); + + /** + * 批量删除生产工单 + * + * @param objIds 需要删除的生产工单主键集合 + * @return 结果 + */ + public int deleteProdPlanInfoByObjIds(Long[] objIds); + + /** + * 删除生产工单信息 + * + * @param objId 生产工单主键 + * @return 结果 + */ + public int deleteProdPlanInfoByObjId(Long objId); + + /** + * 订单新增生产工单List + * @param prodPlanInfos + * @return + */ + int orderAddProdPlanInfoList(List prodPlanInfos); +} diff --git a/os-mes/src/main/java/com/os/mes/prod/service/impl/ProdBomInfoServiceImpl.java b/os-mes/src/main/java/com/os/mes/prod/service/impl/ProdBomInfoServiceImpl.java index 4db8bfc..9568789 100644 --- a/os-mes/src/main/java/com/os/mes/prod/service/impl/ProdBomInfoServiceImpl.java +++ b/os-mes/src/main/java/com/os/mes/prod/service/impl/ProdBomInfoServiceImpl.java @@ -6,6 +6,7 @@ import java.util.List; import com.os.common.exception.base.BaseException; import com.os.common.utils.DateUtils; import com.os.common.utils.StringUtils; +import com.os.common.utils.uuid.PlanCodeUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.os.mes.prod.mapper.ProdBomInfoMapper; @@ -127,4 +128,19 @@ public class ProdBomInfoServiceImpl implements IProdBomInfoService { public int deleteProdBomInfoByObjId(Long objId) { return prodBomInfoMapper.deleteProdBomInfoByObjId(objId); } + + /** + * 通过生产BOM生成工单 + * @param prodBomInfo + * @return + */ + @Override + public List generateTickets(ProdBomInfo prodBomInfo) { + List prodBomInfoList = prodBomInfoMapper.selectProdBomInfoList(prodBomInfo); + for (ProdBomInfo bomInfo : prodBomInfoList) { + bomInfo.setPlanCode(PlanCodeUtils.getPlanCode()); + } + return prodBomInfoList; + } + } diff --git a/os-mes/src/main/java/com/os/mes/prod/service/impl/ProdPlanInfoServiceImpl.java b/os-mes/src/main/java/com/os/mes/prod/service/impl/ProdPlanInfoServiceImpl.java new file mode 100644 index 0000000..a459dcf --- /dev/null +++ b/os-mes/src/main/java/com/os/mes/prod/service/impl/ProdPlanInfoServiceImpl.java @@ -0,0 +1,105 @@ +package com.os.mes.prod.service.impl; + +import java.util.List; + +import com.os.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.os.mes.prod.mapper.ProdPlanInfoMapper; +import com.os.mes.prod.domain.ProdPlanInfo; +import com.os.mes.prod.service.IProdPlanInfoService; + +import static com.os.common.utils.SecurityUtils.getUsername; + +/** + * 生产工单Service业务层处理 + * + * @author Yinq + * @date 2024-06-03 + */ +@Service +public class ProdPlanInfoServiceImpl implements IProdPlanInfoService { + @Autowired + private ProdPlanInfoMapper prodPlanInfoMapper; + + /** + * 查询生产工单 + * + * @param objId 生产工单主键 + * @return 生产工单 + */ + @Override + public ProdPlanInfo selectProdPlanInfoByObjId(Long objId) { + return prodPlanInfoMapper.selectProdPlanInfoByObjId(objId); + } + + /** + * 查询生产工单列表 + * + * @param prodPlanInfo 生产工单 + * @return 生产工单 + */ + @Override + public List selectProdPlanInfoList(ProdPlanInfo prodPlanInfo) { + return prodPlanInfoMapper.selectProdPlanInfoList(prodPlanInfo); + } + + /** + * 新增生产工单 + * + * @param prodPlanInfo 生产工单 + * @return 结果 + */ + @Override + public int insertProdPlanInfo(ProdPlanInfo prodPlanInfo) { + return prodPlanInfoMapper.insertProdPlanInfo(prodPlanInfo); + } + + /** + * 修改生产工单 + * + * @param prodPlanInfo 生产工单 + * @return 结果 + */ + @Override + public int updateProdPlanInfo(ProdPlanInfo prodPlanInfo) { + return prodPlanInfoMapper.updateProdPlanInfo(prodPlanInfo); + } + + /** + * 批量删除生产工单 + * + * @param objIds 需要删除的生产工单主键 + * @return 结果 + */ + @Override + public int deleteProdPlanInfoByObjIds(Long[] objIds) { + return prodPlanInfoMapper.deleteProdPlanInfoByObjIds(objIds); + } + + /** + * 删除生产工单信息 + * + * @param objId 生产工单主键 + * @return 结果 + */ + @Override + public int deleteProdPlanInfoByObjId(Long objId) { + return prodPlanInfoMapper.deleteProdPlanInfoByObjId(objId); + } + + /** + * 订单新增生产工单List + * @param prodPlanInfos + * @return + */ + @Override + public int orderAddProdPlanInfoList(List prodPlanInfos) { + for (ProdPlanInfo prodPlanInfo : prodPlanInfos) { + prodPlanInfo.setCreatedBy(getUsername()); + prodPlanInfo.setCreatedTime(DateUtils.getNowDate()); + prodPlanInfoMapper.insertProdPlanInfo(prodPlanInfo); + } + return 1; + } +} diff --git a/os-mes/src/main/resources/mapper/mes/prod/ProdBomInfoMapper.xml b/os-mes/src/main/resources/mapper/mes/prod/ProdBomInfoMapper.xml index 14b0cfd..b0f068e 100644 --- a/os-mes/src/main/resources/mapper/mes/prod/ProdBomInfoMapper.xml +++ b/os-mes/src/main/resources/mapper/mes/prod/ProdBomInfoMapper.xml @@ -69,7 +69,7 @@ and pbi.material_type = #{materialType} and pbi.material_desc = #{materialDesc} and pbi.standard_amount = #{standardAmount} - and pbi.parent_id = #{parentId} + and pbi.parent_id = #{parentId} and pbi.parent_name like concat('%', #{parentName}, '%') and pbi.factory_code = #{factoryCode} diff --git a/os-mes/src/main/resources/mapper/mes/prod/ProdPlanInfoMapper.xml b/os-mes/src/main/resources/mapper/mes/prod/ProdPlanInfoMapper.xml new file mode 100644 index 0000000..5b193e1 --- /dev/null +++ b/os-mes/src/main/resources/mapper/mes/prod/ProdPlanInfoMapper.xml @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + select obj_id, + plan_code, + order_code, + material_code, + material_name, + station_code, + device_code, + team_code, + plan_amount, + complete_amount, + begin_time, + end_time, + comp_flag, + created_by, + created_time, + updated_by, + updated_time, + plan_begin_time, + plan_end_time + from prod_plan_info + + + + + + + + insert into prod_plan_info + + plan_code, + order_code, + material_code, + material_name, + station_code, + device_code, + team_code, + plan_amount, + complete_amount, + begin_time, + end_time, + comp_flag, + created_by, + created_time, + updated_by, + updated_time, + plan_begin_time, + plan_end_time, + + + #{planCode}, + #{orderCode}, + #{materialCode}, + #{materialName}, + #{stationCode}, + #{deviceCode}, + #{teamCode}, + #{planAmount}, + #{completeAmount}, + #{beginTime}, + #{endTime}, + #{compFlag}, + #{createdBy}, + #{createdTime}, + #{updatedBy}, + #{updatedTime}, + #{planBeginTime}, + #{planEndTime}, + + + + + update prod_plan_info + + plan_code = #{planCode}, + order_code = #{orderCode}, + material_code = #{materialCode}, + material_name = #{materialName}, + station_code = #{stationCode}, + device_code = #{deviceCode}, + team_code = #{teamCode}, + plan_amount = #{planAmount}, + complete_amount = #{completeAmount}, + begin_time = #{beginTime}, + end_time = #{endTime}, + comp_flag = #{compFlag}, + created_by = #{createdBy}, + created_time = #{createdTime}, + updated_by = #{updatedBy}, + updated_time = #{updatedTime}, + plan_begin_time = #{planBeginTime}, + plan_end_time = #{planEndTime}, + + where obj_id = #{objId} + + + + delete + from prod_plan_info + where obj_id = #{objId} + + + + delete from prod_plan_info where obj_id in + + #{objId} + + + \ No newline at end of file