湿料计划(修改湿料计划)

highway
wws 1 year ago
parent 97083e9206
commit e86bddaf1c

@ -129,4 +129,11 @@ public interface ProWetMaterialPlanMapper {
* @return
*/
ProWetMaterialPlan selectProWetMaterialPlanByWorkId(String workorderId);
/**
* id湿
* @param workorderId
* @return
*/
ProWetMaterialPlan selectProWetMaterialPlanByWorkIdN(String workorderId);
}

@ -19,6 +19,7 @@ import com.op.system.api.domain.dto.WCSDTO;
import com.op.system.api.domain.dto.WCSDataDTO;
import com.op.system.api.domain.dto.WCSDataItemsDTO;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@ -29,6 +30,7 @@ import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.PathVariable;
import static com.op.common.core.web.domain.AjaxResult.error;
@ -51,6 +53,7 @@ public class ProWetMaterialPlanServiceImpl implements IProWetMaterialPlanService
//
// @Value("${wcs.url1}")
// public String materialPlanSyncUrl;
/**
* 湿
*
@ -248,12 +251,39 @@ public class ProWetMaterialPlanServiceImpl implements IProWetMaterialPlanService
@DS("#header.poolName")
public AjaxResult getWetMaterialPlanDetailListById(String id) {
List<ProWetMaterialPlanDetail> detailList = proWetMaterialPlanDetailMapper.selectProWetMaterialPlanDetailListById(id);
// 获取班次名称和料罐名称
// 湿料详情数据处理(去重)
List<ProWetMaterialPlanDetail> tempList = new ArrayList<>();
for (ProWetMaterialPlanDetail detail : detailList) {
ProWetMaterialPlanDetail temp = new ProWetMaterialPlanDetail();
// 获取班次名称和料罐名称
detail.setShiftDesc(proWetMaterialPlanMapper.selectShiftById(String.valueOf(detail.getShiftId())));
detail.setBucketName(proWetMaterialPlanMapper.selectBucketNameById(detail.getBucketId()));
BeanUtils.copyProperties(detail,temp);
if (tempList.size() == 0) {
tempList.add(temp);
}else {
boolean check = true;
for (ProWetMaterialPlanDetail data : tempList) {
// 找到重复
if (data.getWorkorderCode().equals(temp.getWorkorderCode())) {
check = false;
StringBuilder bucketName = new StringBuilder(data.getBucketName());
bucketName.append(",").append(temp.getBucketName());
data.setBucketName(bucketName.toString());
}
return success(detailList);
}
if (check) {
tempList.add(temp);
}
}
}
return success(tempList);
}
/**
@ -267,19 +297,27 @@ public class ProWetMaterialPlanServiceImpl implements IProWetMaterialPlanService
@Transactional
public AjaxResult updateWetMaterialPlanDetail(List<ProWetMaterialPlanDetail> detailList) {
// 获取该计划详情下的主计划信息
ProWetMaterialPlan proWetMaterialPlan = proWetMaterialPlanMapper.selectProWetMaterialPlanById(detailList.get(0).getWetMaterialPlanId());
ProWetMaterialPlan proWetMaterialPlan = proWetMaterialPlanMapper.selectProWetMaterialPlanByWorkIdN(detailList.get(0).getWorkorderId());
// 更新主计划信息
// 更新人
proWetMaterialPlan.setUpdateBy(SecurityContextHolder.getUserName());
// 更新时间
proWetMaterialPlan.setUpdateTime(DateUtils.getNowDate());
// 更新至数据库
proWetMaterialPlanMapper.updateProWetMaterialPlan(proWetMaterialPlan);
// 循环将详情信息更新至数据库
// 删除所有详情信息
proWetMaterialPlanDetailMapper.deleteProWetMaterialPlanDetailByPlanId(proWetMaterialPlan.getId());
for (ProWetMaterialPlanDetail detail : detailList) {
proWetMaterialPlanDetailMapper.updateProWetMaterialPlanDetail(detail);
ProOrderWorkorder workOrder = new ProOrderWorkorder();
BeanUtils.copyProperties(detail,workOrder);
workOrder.setShiftId(String.valueOf(detail.getShiftId()));
workOrder.setBucketId(Integer.valueOf(detail.getBucketId()));
workOrder.setMaterialId(Integer.valueOf(detail.getMaterialId()));
proWetMaterialPlanDetailMapper.insertProWetMaterialPlanDetail(createProWetMaterialPlanDetail(workOrder,proWetMaterialPlan.getId()));
}
// throw new RuntimeException();
return success();
}

@ -117,7 +117,7 @@
<include refid="selectProOrderWorkorderVo"/>
where workorder_id not in (
select workorder_id
from pro_wet_material_plan_detail)
from pro_wet_material_plan_detail where del_flag = '0')
and CONVERT(date, product_date) = #{productDate} and prod_type = 'white'
and del_flag = '0'
</select>

@ -100,8 +100,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select id, factory_code, plan_time, sync_flag, create_by, create_time, update_by, update_time,
order_type, prod_code, prod_desc, prod_source, quantity, unit, atrr1, atrr2, atrr3, status,
prod_type, plan_code, shift_id, shift_desc from pro_wet_material_plan
where id = (select wet_material_plan_id from pro_wet_material_plan_detail
where workorder_id = #{workorderId}) and sync_flag = 'Y' and del_flag = '0'
where id = (select TOP 1 wet_material_plan_id from pro_wet_material_plan_detail
where workorder_id = #{workorderId} and del_flag = '0') and sync_flag = 'Y' and del_flag = '0'
</select>
<select id="selectProWetMaterialPlanByWorkIdN" resultType="com.op.plan.domain.ProWetMaterialPlan">
select id, factory_code, plan_time, sync_flag, create_by, create_time, update_by, update_time,
order_type, prod_code, prod_desc, prod_source, quantity, unit, atrr1, atrr2, atrr3, status,
prod_type, plan_code, shift_id, shift_desc from pro_wet_material_plan
where id = (select TOP 1 wet_material_plan_id from pro_wet_material_plan_detail
where workorder_id = #{workorderId} and del_flag = '0') and sync_flag = 'N' and del_flag = '0'
</select>
<insert id="insertProWetMaterialPlan" parameterType="ProWetMaterialPlan">

Loading…
Cancel
Save