生产订单管理模块(优化拆分显示)、湿料计划管理(BMS)

highway
wws 1 year ago
parent e8f9176634
commit ed1245fc5a

@ -35,6 +35,27 @@ public class ProWetMaterialPlanController extends BaseController {
@Autowired
private IProWetMaterialPlanService proWetMaterialPlanService;
/**
* list
*
* @param planTime
* @return
*/
@GetMapping("/getBMSList")
public AjaxResult getBMSList(Date planTime){
return proWetMaterialPlanService.getBMSList(planTime);
}
/**
* list
*
* @return
*/
@GetMapping("/getProductList")
public AjaxResult getProductList() {
return proWetMaterialPlanService.getProductList();
}
/**
* list
*

@ -0,0 +1,47 @@
package com.op.mes.domain;
// 料罐id、物料id、班次id 实体类
public class BMS {
// 料罐id
private Integer bucketId;
// 物料id
private Integer materialId;
// 班次id
private Integer shiftId;
public Integer getBucketId() {
return bucketId;
}
public void setBucketId(Integer bucketId) {
this.bucketId = bucketId;
}
public Integer getMaterialId() {
return materialId;
}
public void setMaterialId(Integer materialId) {
this.materialId = materialId;
}
public Integer getShiftId() {
return shiftId;
}
public void setShiftId(Integer shiftId) {
this.shiftId = shiftId;
}
@Override
public String toString() {
return "BMS{" +
"bucketId=" + bucketId +
", materialId=" + materialId +
", shiftId=" + shiftId +
'}';
}
public BMS() {
}
}

@ -0,0 +1,47 @@
package com.op.mes.domain;
// 物料实体类
public class Product {
// 物料id
private Integer productId;
// 物料code
private String productCode;
// 物料名称Desc
private String productDesc;
@Override
public String toString() {
return "Product{" +
"productId=" + productId +
", productCode='" + productCode + '\'' +
", productDesc='" + productDesc + '\'' +
'}';
}
public Integer getProductId() {
return productId;
}
public void setProductId(Integer productId) {
this.productId = productId;
}
public String getProductCode() {
return productCode;
}
public void setProductCode(String productCode) {
this.productCode = productCode;
}
public String getProductDesc() {
return productDesc;
}
public void setProductDesc(String productDesc) {
this.productDesc = productDesc;
}
public Product() {
}
}

@ -3,8 +3,10 @@ package com.op.mes.mapper;
import java.util.Date;
import java.util.List;
import com.op.mes.domain.BMS;
import com.op.mes.domain.Bucket;
import com.op.mes.domain.ProWetMaterialPlan;
import com.op.mes.domain.Product;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
@ -83,8 +85,25 @@ public interface ProWetMaterialPlanMapper {
/**
* list
*
* @return
*/
@Select("SELECT equipment_id AS 'bucketId',equipment_code AS 'bucketCode',equipment_name AS 'bucketName' FROM base_equipment WHERE equipment_type_code = 'equ_type_lg'")
List<Bucket> selectBucketList();
/**
* list
*
* @return
*/
@Select("SELECT product_id AS 'productId', product_code AS 'productCode',product_desc_zh AS 'productDesc' FROM base_product WHERE active_flag = '1'")
List<Product> selectProductList();
/**
* list
*
* @param planTime
* @return
*/
List<BMS> selectBMSList(Date planTime);
}

@ -71,7 +71,23 @@ public interface IProWetMaterialPlanService {
/**
* list
*
* @return
*/
AjaxResult getBucketList();
/**
* list
*
* @return
*/
AjaxResult getProductList();
/**
* list
*
* @param planTime
* @return
*/
AjaxResult getBMSList(Date planTime);
}

@ -124,7 +124,7 @@ public class ProOrderServiceImpl implements IProOrderService {
}
// 设置为底层节点
if (checkEnd == 1){
if (checkEnd == 1) {
updateWorker.setWorkorderId(secWorkOrder.getWorkorderId());
updateWorker.setIsEnd(1);
proOrderWorkorderMapper.updateProOrderWorkorder(updateWorker);
@ -133,7 +133,7 @@ public class ProOrderServiceImpl implements IProOrderService {
}
// 设置为底层节点
if (checkEnd == 1){
if (checkEnd == 1) {
updateWorker.setWorkorderId(firWorkOrder.getWorkorderId());
updateWorker.setIsEnd(1);
proOrderWorkorderMapper.updateProOrderWorkorder(updateWorker);
@ -158,23 +158,23 @@ public class ProOrderServiceImpl implements IProOrderService {
// 通过订单id查询所有工单信息list
List<ProOrderWorkorder> proOrderWorkorderList = proOrderWorkorderMapper.selectFirWorkOrder(id);
// 母工单循环遍历
for (int i = 0;i < proOrderWorkorderList.size();i++){
for (int i = 0; i < proOrderWorkorderList.size(); i++) {
// 通过设备code查询出机型名称
String prodLineName = proOrderMapper.selectProdLineName(proOrderWorkorderList.get(i).getProdLineCode());
// 通过工单id查询批次号
List<String> batchCodeList = proOrderMapper.selectBatchCodesById(proOrderWorkorderList.get(i).getWorkorderId());
List<StringBuilder> batchCodes = new ArrayList<>();
// 格式化数据
for (int j = 0;j < batchCodeList.size();j++){
for (int j = 0; j < batchCodeList.size(); j++) {
batchCodes.add(new StringBuilder(batchCodeList.get(j)).append(";").append("\n"));
}
// 通过母工单workorder_id查询子工单
// 二级
List<ProOrderWorkorder> secProOrderWorkorder = proOrderWorkorderMapper.selectChildWorkOrder(proOrderWorkorderList.get(i).getWorkorderCode());
if (secProOrderWorkorder.size() > 0 && secProOrderWorkorder != null){
if (secProOrderWorkorder.size() > 0 && secProOrderWorkorder != null) {
// 三级
List<ProOrderWorkorder> thiProOrderWorkorders = proOrderWorkorderMapper.selectChildWorkOrder(secProOrderWorkorder.get(0).getWorkorderCode());
if (thiProOrderWorkorders.size() > 0 && thiProOrderWorkorders != null){
if (thiProOrderWorkorders.size() > 0 && thiProOrderWorkorders != null) {
// 将三级放入二级child
thiProOrderWorkorders.get(0).setProdLineCode(prodLineName);
thiProOrderWorkorders.get(0).setBatchCodeList(batchCodes);
@ -251,7 +251,14 @@ public class ProOrderServiceImpl implements IProOrderService {
@Override
@DS("#header.poolName")
public List<ProOrder> selectProOrderList(ProOrder proOrder) {
return proOrderMapper.selectProOrderList(proOrder);
if (proOrder.getStatus() == null || proOrder.getStatus().equals(" ")){
proOrder.setStatus("1");
}
List<ProOrder> proOrderList = proOrderMapper.selectProOrderList(proOrder);
for (int i = 0; i < proOrderList.size(); i++) {
proOrderList.get(i).setStatus(changeStatus(proOrderList.get(i).getStatus()));
}
return proOrderList;
}
/**
@ -411,4 +418,19 @@ public class ProOrderServiceImpl implements IProOrderService {
}
}
/**
*
*
* @param status
* @return
*/
private String changeStatus(String status) {
if (status.equals("0")){
return "未拆分";
}
if (status.equals("1")){
return "已拆分";
}
return status;
}
}

@ -1,12 +1,13 @@
package com.op.mes.service.impl;
import java.util.Date;
import java.util.List;
import java.util.*;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.web.domain.AjaxResult;
import com.op.mes.domain.BMS;
import com.op.mes.domain.ProOrderWorkorder;
import com.op.mes.domain.Product;
import com.op.mes.mapper.ProOrderWorkorderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -14,6 +15,7 @@ import com.op.mes.mapper.ProWetMaterialPlanMapper;
import com.op.mes.domain.ProWetMaterialPlan;
import com.op.mes.service.IProWetMaterialPlanService;
import static com.op.common.core.web.domain.AjaxResult.error;
import static com.op.common.core.web.domain.AjaxResult.success;
/**
@ -38,6 +40,10 @@ public class ProWetMaterialPlanServiceImpl implements IProWetMaterialPlanService
@Override
@DS("#header.poolName")
public ProWetMaterialPlan selectProWetMaterialPlanById(String id) {
// 参数判空
if (id == null || id.equals("")){
return null;
}
return proWetMaterialPlanMapper.selectProWetMaterialPlanById(id);
}
@ -115,9 +121,13 @@ public class ProWetMaterialPlanServiceImpl implements IProWetMaterialPlanService
@Override
@DS("#header.poolName")
public AjaxResult getWorkOrderByTime(Date productDate) {
// 参数判空
if (productDate == null){
return error("参数为空!");
}
List<ProOrderWorkorder> workorderList = proOrderWorkorderMapper.selectWorkOrderByTime(productDate);
// 循环遍历
for (int i = 0; i < workorderList.size(); i++){
for (int i = 0; i < workorderList.size(); i++) {
// 通过班次id获取班次名称
workorderList.get(i).setShiftDesc(proWetMaterialPlanMapper.selectShiftById(workorderList.get(i).getShiftId()));
}
@ -126,6 +136,7 @@ public class ProWetMaterialPlanServiceImpl implements IProWetMaterialPlanService
/**
* list
*
* @return
*/
@Override
@ -133,4 +144,31 @@ public class ProWetMaterialPlanServiceImpl implements IProWetMaterialPlanService
public AjaxResult getBucketList() {
return success(proWetMaterialPlanMapper.selectBucketList());
}
/**
* list
*
* @return
*/
@Override
@DS("#header.poolName")
public AjaxResult getProductList() {
return success(proWetMaterialPlanMapper.selectProductList());
}
/**
* list
*
* @param planTime
* @return
*/
@Override
@DS("#header.poolName")
public AjaxResult getBMSList(Date planTime) {
// 参数判空
if (planTime == null){
return error("参数为空!");
}
return success(proWetMaterialPlanMapper.selectBMSList(planTime));
}
}

@ -61,6 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="prodType != null and prodType != ''"> and prod_type = #{prodType}</if>
<if test="prodSpc != null and prodSpc != ''"> and prod_spc = #{prodSpc}</if>
</where>
ORDER BY plan_pro_date DESC
</select>
<select id="selectProOrderById" parameterType="String" resultMap="ProOrderResult">
@ -165,7 +166,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateOrder">
update pro_order
<trim prefix="SET" suffixOverrides=",">
<if test="atrr1 != null">quantity_split += #{atrr1},</if>
<if test="atrr1 != null and quantitySplit != null">quantity_split += #{atrr1},</if>
<if test="quantitySplit == null">quantity_split = #{atrr1},</if>
<if test="updateBy != null">create_by = #{updateBy},</if>
<if test="updateTime != null">create_time = #{updateTime},</if>
status = 1,

@ -47,6 +47,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE CONVERT(date, plan_time) BETWEEN #{startTime} AND #{endTime}
ORDER BY CONVERT(date, plan_time) DESC , sync_flag
</select>
<select id="selectBMSList" resultType="com.op.mes.domain.BMS">
SELECT bucket_id AS 'bucketId', material_id AS 'materialId',shift_id AS 'shiftId'
FROM pro_wet_material_plan_detail
WHERE status = '1' AND CONVERT(date, create_time) = #{planTime}
GROUP BY bucket_id,material_id,shift_id
</select>
<insert id="insertProWetMaterialPlan" parameterType="ProWetMaterialPlan">
insert into pro_wet_material_plan

Loading…
Cancel
Save