辅助排产1.0

master
zhaoxiaolin 7 months ago
parent ad5b9ee7a3
commit 0785b6b95b

@ -133,6 +133,10 @@ public class ProOrderController extends BaseController {
return proOrderService.getWorkOrderList(id);
}
@GetMapping(value = "/getWorkOrderListCG/{id}")
public AjaxResult getWorkOrderListCG(@PathVariable("id") String id) {
return proOrderService.getWorkOrderListCG(id);
}
/**
*
@ -341,4 +345,15 @@ public class ProOrderController extends BaseController {
return proOrderService.autoSplitOrder(proOrder);
}
/**辅助排产取消**/
@PostMapping("/autoSplitOrderCancel")
public R autoSplitOrderCancel(@RequestBody ProOrder proOrder) {
return proOrderService.autoSplitOrderCancel(proOrder);
}
/**辅助排产提交**/
@PostMapping("/autoSplitOrderOk")
public R autoSplitOrderOk(@RequestBody ProOrder proOrder) {
return proOrderService.autoSplitOrderOk(proOrder);
}
}

@ -6,6 +6,24 @@ public class ProLine {
private String label;
private String lineCode;
private String lineName;
private Long efficiency;
private String dh;
public Long getEfficiency() {
return efficiency;
}
public void setEfficiency(Long efficiency) {
this.efficiency = efficiency;
}
public String getDh() {
return dh;
}
public void setDh(String dh) {
this.dh = dh;
}
public String getLineCode() {
return lineCode;

@ -1,5 +1,8 @@
package com.op.plan.domain.dto;
import com.op.plan.domain.ProOrder;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@ -105,6 +108,124 @@ public class ProOrderDTO {
private Integer sortNo;
private String bomBo;
private String syncUser;
private String productDate;
private String lineCode;
private String lineName;
private List<ProOrder> lineList;
private List<String> recommendLineList;//推荐线体
private Integer useMan;
private BigDecimal efficiency;
private String[] lineCodes;
private String routeCode;
private Integer endFlag;
private String belongWorkOrder;
public String getBomBo() {
return bomBo;
}
public void setBomBo(String bomBo) {
this.bomBo = bomBo;
}
public String getSyncUser() {
return syncUser;
}
public void setSyncUser(String syncUser) {
this.syncUser = syncUser;
}
public String getProductDate() {
return productDate;
}
public void setProductDate(String productDate) {
this.productDate = productDate;
}
public String getLineCode() {
return lineCode;
}
public void setLineCode(String lineCode) {
this.lineCode = lineCode;
}
public String getLineName() {
return lineName;
}
public void setLineName(String lineName) {
this.lineName = lineName;
}
public List<ProOrder> getLineList() {
return lineList;
}
public void setLineList(List<ProOrder> lineList) {
this.lineList = lineList;
}
public List<String> getRecommendLineList() {
return recommendLineList;
}
public void setRecommendLineList(List<String> recommendLineList) {
this.recommendLineList = recommendLineList;
}
public Integer getUseMan() {
return useMan;
}
public void setUseMan(Integer useMan) {
this.useMan = useMan;
}
public BigDecimal getEfficiency() {
return efficiency;
}
public void setEfficiency(BigDecimal efficiency) {
this.efficiency = efficiency;
}
public String[] getLineCodes() {
return lineCodes;
}
public void setLineCodes(String[] lineCodes) {
this.lineCodes = lineCodes;
}
public String getRouteCode() {
return routeCode;
}
public void setRouteCode(String routeCode) {
this.routeCode = routeCode;
}
public Integer getEndFlag() {
return endFlag;
}
public void setEndFlag(Integer endFlag) {
this.endFlag = endFlag;
}
public String getBelongWorkOrder() {
return belongWorkOrder;
}
public void setBelongWorkOrder(String belongWorkOrder) {
this.belongWorkOrder = belongWorkOrder;
}
public Integer getCarNum() {
return carNum;
}

@ -240,4 +240,16 @@ public interface ProOrderMapper {
List<ProOrder> getCanProductLine();
List<ProOrder> getSelectLineLevel1(ProOrder proOrder);
List<ProOrderWorkorderBatch> selectBatchCodesByIdCG(String workorderId);
int deleteAutoSplitWork(String orderCode);
int deleteAutoSplitWorkBatch(String orderCode);
int updateAutoSplitWorkBatch(String orderCode);
int updateAutoSplitWork(String orderCode);
int updateAutoSplitOrder(String orderCode);
}

@ -89,4 +89,6 @@ public interface ProOrderWorkorderBatchMapper {
List<String> checkBatchCodeByWorkOrderIds(@Param("workorderIds")String[] workorderIds,@Param("newbatchs") List<String> newbatchs);
List<ProLine> getProdLineList();
int insertWorkorderBatchs(@Param("list") List<ProOrderWorkorderBatch> workBatchs);
}

@ -9,6 +9,7 @@ import com.op.system.api.domain.dto.MesPrepareDetailDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@ -217,10 +218,18 @@ public interface ProOrderWorkorderMapper {
int updateCheckTaskBatch(CheckTaskBatchDTO checkTaskBatchDTO);
Long getLineProductInfo(ProOrder proOrder);
ProLine getLineProductInfo(ProOrder proOrder);
String getProcessCode(String routeCode);
int insertWorkorders(@Param("list") List<ProOrderWorkorder> workorders);
BaseProduct getProductInfo(ProOrder proOrder);
BigDecimal getQuaRatio(String productCode);
List<ProOrderWorkorder> selectFirWorkOrderCG(String id);
List<ProOrderWorkorder> selectChildWorkOrderCG(String workorderCode);
}

@ -149,4 +149,10 @@ public interface IProOrderService {
ProOrder getCanProductLine(ProOrder proOrder);
R autoSplitOrder(ProOrder proOrder);
AjaxResult getWorkOrderListCG(String id);
R autoSplitOrderCancel(ProOrder proOrder);
R autoSplitOrderOk(ProOrder proOrder);
}

@ -416,6 +416,99 @@ public class ProOrderServiceImpl implements IProOrderService {
}
}
/**辅助排产结果查看**/
@Override
@DS("#header.poolName")
public AjaxResult getWorkOrderListCG(String id) {
// 通过订单id查询所有母工单信息list
List<ProOrderWorkorder> proOrderWorkorderList = proOrderWorkorderMapper.selectFirWorkOrderCG(id);
for (ProOrderWorkorder proOrderWorkorder : proOrderWorkorderList) {
formatProOrderWorkorderCG(proOrderWorkorder);
}
return success(proOrderWorkorderList);
}
@Override
@DS("#header.poolName")
public R autoSplitOrderCancel(ProOrder proOrder) {
ProOrder order = proOrder;
/**pro_order_workorder_batch**/
int n = proOrderMapper.deleteAutoSplitWorkBatch(proOrder.getOrderCode());
logger.info("n:"+n);
/**pro_order_workorder**/
int m = proOrderMapper.deleteAutoSplitWork(proOrder.getOrderCode());
logger.info("m:"+m);
return R.ok();
}
@Override
@DS("#header.poolName")
public R autoSplitOrderOk(ProOrder proOrder) {
ProOrder order = proOrder;
/**pro_order_workorder_batch**/
int n = proOrderMapper.updateAutoSplitWorkBatch(proOrder.getOrderCode());
logger.info("n:"+n);
/**pro_order_workorder**/
int m = proOrderMapper.updateAutoSplitWork(proOrder.getOrderCode());
logger.info("m:"+m);
/**pro_order**/
int s = proOrderMapper.updateAutoSplitOrder(proOrder.getOrderCode());
logger.info("s:"+s);
return R.ok();
}
/**
*
*
* @param proOrderWorkorder
*/
private void formatProOrderWorkorderCG(ProOrderWorkorder proOrderWorkorder) {
StringBuilder prodLineName = new StringBuilder("");
StringBuilder equipCods = new StringBuilder("'");
JSONArray codeArray = JSONArray.parseArray(proOrderWorkorder.getProdLineCode());
for(int c=0;c<codeArray.size();c++){
equipCods.append(codeArray.getJSONArray(c).getString(1));
equipCods.append("','");
}
Map<String,CascaderDTO> equipMap = proOrderMapper.getEquipInfoByCodes(equipCods.substring(1));//设备字典
for (int c = 0; c < codeArray.size(); c++) {
String equipCode = codeArray.getJSONArray(c).getString(1);
prodLineName.append(equipMap.get(equipCode).getLabel() + ",");
}
proOrderWorkorder.setProdLineCode(prodLineName.toString());
// 通过工单id查询批次号
List<ProOrderWorkorderBatch> batchCodeList = proOrderMapper.selectBatchCodesByIdCG(proOrderWorkorder.getWorkorderId());
List<StringBuilder> batchCodes = new ArrayList<>();
List<StringBuilder> batchNums = new ArrayList<>();
// 格式化数据
for (ProOrderWorkorderBatch batchCode : batchCodeList) {
batchCodes.add(new StringBuilder(batchCode.getBatchCode()).append(";"));
batchNums.add(new StringBuilder(batchCode.getBatchQuantity()+"").append(";"));
}
proOrderWorkorder.setBatchCodeList(batchCodes);
proOrderWorkorder.setBatchNumList(batchNums);
// 通过母工单workorder_id查询子工单
List<ProOrderWorkorder> childWorkorders = proOrderWorkorderMapper.selectChildWorkOrderCG(proOrderWorkorder.getWorkorderCode());
if (!childWorkorders.isEmpty()) {
for (ProOrderWorkorder childWorkorder : childWorkorders) {
formatProOrderWorkorderCG(childWorkorder); // 递归处理子工单
}
proOrderWorkorder.setChildren(childWorkorders); // 设置子工单列表
}
}
/**
*
*
@ -1235,98 +1328,135 @@ public class ProOrderServiceImpl implements IProOrderService {
@DS("#header.poolName")
public R autoSplitOrder(ProOrder proOrder) {
// Date nowTime = DateUtils.getNowDate();//公共时间
// HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
// String key = "#header.poolName";
// proOrder.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_",""));
// proOrder.setCreateTime(nowTime);
// //订单总量
// Long orderQua = proOrder.getQuantity();
// //有几个设备就有几个工单
// for(int i=0;i<proOrder.getLineCodes().length;i++){
//
// List<ProOrderWorkorder> workorders = new ArrayList<>();
// List<ProOrderWorkorderBatch> workorderBatches = new ArrayList<>();
//
// proOrder.setLineCode(proOrder.getLineCodes()[i]);
// Long efficiency = proOrderWorkorderMapper.getLineProductInfo(proOrder);//线体产能
// if(efficiency==null){
// break;
// logger.error("线体"+proOrder.getLineCodes()[i]+"产能"+efficiency+"无法生产");
// }
// if(efficiency < orderQua){
// proOrder.setQuantitySplit(efficiency);
// }else{
// proOrder.setQuantitySplit(orderQua);
// }
// orderQua = orderQua - efficiency;//消耗订单总数量
// List<ProOrder> sonOrders = (List<ProOrder>)proOrder.getChildren();
// if(CollectionUtils.isEmpty(sonOrders)){//1层订单
// proOrder.setEndFlag(1);
// }
// int endCode = getEndCode(proOrder.getId());
// String belongWorkOrder = proOrder.getOrderCode()+"-"+endCode;
// proOrder.setBelongWorkOrder(belongWorkOrder);
// proOrder.setWorkerOrder(belongWorkOrder);
// proOrder.setParentOrder("0");
// ProOrderWorkorder pworkOrder = getWorkOrderByOrder(proOrder);//TODO;
// //父级
// workorders.add(pworkOrder);
//
// /**pro_order_workorder_batch**/
// String parentWorkOrder = belongWorkOrder;
// while(!CollectionUtils.isEmpty(sonOrders)){
// ProOrder sonOrder = sonOrders.get(0);
// sonOrder.setBelongWorkOrder(belongWorkOrder);
// endCode = getEndCode(proOrder.getId());
// String sworkOrderCode = sonOrder.getOrderCode()+"-"+endCode;
// sonOrder.setBelongWorkOrder(belongWorkOrder);
// sonOrder.setWorkerOrder(sworkOrderCode);
// sonOrder.setParentOrder(parentWorkOrder);
// sonOrders = (List<ProOrder>)sonOrder.getChildren();
// if(CollectionUtils.isEmpty(sonOrders)){//1层订单
// sonOrder.setEndFlag(1);
// }
// ProOrderWorkorder sworkOrder = getWorkOrderByOrder(sonOrder);//TODO;
// workorders.add(sworkOrder);
// parentWorkOrder = sworkOrderCode;
// }
//
// /**pro_order_workorder**/
// if(!CollectionUtils.isEmpty(workorders)){
// int pm = proOrderWorkorderMapper.insertWorkorders(workorders);
// System.out.println("pm:"+pm);
// }
//
// //拆批次
// Long pworkOrderQua = proOrder.getQuantitySplit();//工单数量
// ProOrderWorkorderBatch workBatch = null;
// int batchNum = 1;
// while(pworkOrderQua>0){
// workBatch = new ProOrderWorkorderBatch();
// workBatch.setBatchQuantity(0L);
// List<String> batchCode = StringUtils.batchAutoCreate(proOrder.getFactoryCode(),
// proOrder.getLineCode(),
// DateUtils.dateTime("yyyy-MM-dd",proOrder.getProductDate()),
// proOrder.getAtrr2().substring(proOrder.getAtrr2().length()-1),
// "0",batchNum++);
// workBatch.setBatchCode(batchCode);
// workorderBatches.add(workBatch);
// }
// /**pro_order_workorder_batch**/
// if(!CollectionUtils.isEmpty(workorderBatches)) {
// int pn = proOrderWorkorderBatchMapper.insertWorkorderBatchs(workBatch);
// System.out.println("pn:"+pn);
// }
// }
Date nowTime = DateUtils.getNowDate();//公共时间
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String key = "#header.poolName";
proOrder.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_",""));
proOrder.setCreateTime(nowTime);
//订单总量
proOrder.setQuantitySplit(proOrder.getQuantitySplit()==null?0L:proOrder.getQuantitySplit());
Long orderQua = proOrder.getQuantity()-proOrder.getQuantitySplit();
//有几个设备就有几个工单
for(int i=0;i<proOrder.getLineCodes().length;i++){
if(orderQua == 0L){
logger.info("线体产能满足生产");
break;
}
List<ProOrderWorkorder> workorders = new ArrayList<>();
proOrder.setLineCode(proOrder.getLineCodes()[i]);
ProLine plineInfo = proOrderWorkorderMapper.getLineProductInfo(proOrder);//线体母单产品产能和线体代码
if(plineInfo==null){
logger.error("线体"+proOrder.getLineCodes()[i]+"产能"+plineInfo.getEfficiency()+"无法生产");
break;
}
Long efficiency = plineInfo.getEfficiency();
if(efficiency < orderQua){
proOrder.setQuantitySplit(efficiency);
}else{
proOrder.setQuantitySplit(orderQua);
}
orderQua = orderQua - proOrder.getQuantitySplit();//消耗订单总数量
if(CollectionUtils.isEmpty(proOrder.getChildren())){//1层订单
proOrder.setEndFlag(1);
}
int endCode = getEndCode(proOrder.getId());
String belongWorkOrder = proOrder.getOrderCode()+"-"+endCode;
proOrder.setBelongWorkOrder(belongWorkOrder);
proOrder.setWorkerOrder(belongWorkOrder);
proOrder.setParentOrder("0");
ProOrderWorkorder pworkOrder = getWorkOrderByOrder(proOrder,proOrder);//TODO;
//父级
workorders.add(pworkOrder);
/**pro_order_workorder_batch**/
String parentWorkOrder = belongWorkOrder;
ProOrder order = proOrder;
while(!CollectionUtils.isEmpty(order.getChildren())){
// 解决方案就是将list再次转为json串然后由json串再转为list
String s = JSON.toJSONString(order.getChildren());
List<ProOrder> oragainzation = JSON.parseArray(s, ProOrder.class);
ProOrder sonOrder = oragainzation.get(0);
sonOrder.setBelongWorkOrder(belongWorkOrder);
String sworkOrderCode = sonOrder.getOrderCode()+"-"+(++endCode);
sonOrder.setBelongWorkOrder(belongWorkOrder);
sonOrder.setWorkerOrder(sworkOrderCode);
sonOrder.setParentOrder(parentWorkOrder);
sonOrder.setQuantitySplit(sonOrder.getQuantity());
if(CollectionUtils.isEmpty(sonOrder.getChildren())){
sonOrder.setEndFlag(1);
}
ProOrderWorkorder sworkOrder = getWorkOrderByOrder(sonOrder,proOrder);//TODO;
workorders.add(sworkOrder);
order = sonOrder;
parentWorkOrder = sworkOrderCode;
}
/**pro_order_workorder**/
if(!CollectionUtils.isEmpty(workorders)){
//计算子单拆分数量
for(int wm=0;wm<workorders.size();wm++){
BigDecimal wquaRatio = null;
if(wm != 0){//子单需要折算数量
wquaRatio = new BigDecimal(workorders.get(wm).getQuantitySplit())
.divide(new BigDecimal(workorders.get(0).getQuantitySplit()),2,BigDecimal.ROUND_UP);//proOrderWorkorderMapper.getQuaRatio(workorders.get(m-1).getProductCode());
workorders.get(wm).setQuantitySplit(wquaRatio.multiply(new BigDecimal(workorders.get(0).getQuantitySplit()))
.longValue());
}
}
int pm = proOrderWorkorderMapper.insertWorkorders(workorders);
System.out.println("pm:"+pm);
}
/**拆批次**/
proOrder.setProdSpc(plineInfo.getDh());//借用字段
List<ProOrderWorkorderBatch> workorderBatches0 = getBatchList(proOrder);//TODO;
List<ProOrderWorkorderBatch> workBatchs = new ArrayList<>();
for(int m=0;m<workorders.size();m++){
ProOrderWorkorder work = workorders.get(m);
ProOrderWorkorderBatch wBatch = null;
BigDecimal quaRatio = null;
if(m != 0){//子单需要折算数量
quaRatio = new BigDecimal(workorders.get(m).getQuantitySplit())
.divide(new BigDecimal(workorders.get(0).getQuantitySplit()),2,BigDecimal.ROUND_UP);//proOrderWorkorderMapper.getQuaRatio(workorders.get(m-1).getProductCode());
}
for(ProOrderWorkorderBatch workBatch:workorderBatches0){
wBatch = new ProOrderWorkorderBatch();
wBatch.setBatchId(IdUtils.fastSimpleUUID());
wBatch.setCreateBy(SecurityUtils.getUsername());
wBatch.setCreateTime(proOrder.getCreateTime());
if(m != 0 && quaRatio!=null){//母单的数量已有
wBatch.setBatchQuantity(quaRatio.multiply(new BigDecimal(workBatch.getBatchQuantity())).longValue());
}else{
wBatch.setBatchQuantity(workBatch.getBatchQuantity());
}
wBatch.setWorkorderId(work.getWorkorderId());
wBatch.setBatchCode(workBatch.getBatchCode());
workBatchs.add(wBatch);
}
}
/**pro_order_workorder_batch**/
if(!CollectionUtils.isEmpty(workBatchs)) {
int pn = proOrderWorkorderBatchMapper.insertWorkorderBatchs(workBatchs);
System.out.println("pn:"+pn);
}
}
return R.ok();
}
protected ProOrderWorkorder getWorkOrderByOrder(ProOrder proOrder){
/**
*
* @param proOrder
* @param pOrder
* @return
*/
protected ProOrderWorkorder getWorkOrderByOrder(ProOrder proOrder,ProOrder pOrder){
ProOrderWorkorder workOrder = new ProOrderWorkorder();
workOrder.setWorkorderId(IdUtils.fastSimpleUUID());
int endCode = getEndCode(proOrder.getId());
workOrder.setWorkorderCode(proOrder.getWorkerOrder());
workOrder.setBelongWorkOrder(proOrder.getBelongWorkOrder());
workOrder.setOrderId(proOrder.getId());
@ -1335,23 +1465,56 @@ public class ProOrderServiceImpl implements IProOrderService {
workOrder.setProductName(proOrder.getProdDesc());
workOrder.setUnit(proOrder.getUnit());
workOrder.setQuantitySplit(proOrder.getQuantitySplit());
workOrder.setRouteCode(proOrder.getRouteCode());
workOrder.setRouteCode(pOrder.getRouteCode());
String gxCode = "CP";//proOrderWorkorderMapper.getProcessCode(proOrder.getRouteCode());
String[][] lineCodeArray = {{gxCode,proOrder.getLineCode()}};
workOrder.setProdLineCodeArray(lineCodeArray);
workOrder.setProductDate(DateUtils.dateTime("yyyy-MM-dd",proOrder.getProductDate()));
String[][] lineCodeArray = {{gxCode,pOrder.getLineCode()}};
workOrder.setProdLineCode(JSONArray.toJSONString(lineCodeArray));
workOrder.setProductDate(DateUtils.dateTime("yyyy-MM-dd",pOrder.getProductDate()));
//workOrder.setShiftId();
workOrder.setParentOrder(proOrder.getParentOrder());
workOrder.setStatus("w0");
workOrder.setCreateBy(SecurityUtils.getUsername());
workOrder.setCreateTime(proOrder.getCreateTime());
workOrder.setCreateTime(pOrder.getCreateTime());
workOrder.setProdType(proOrder.getOrderType());
workOrder.setFactoryCode(proOrder.getFactoryCode());
workOrder.setFactoryCode(pOrder.getFactoryCode());
workOrder.setEndFlag(proOrder.getEndFlag());
workOrder.setSortNo(proOrder.getSortNo());
workOrder.setSortNo(pOrder.getSortNo());
return workOrder;
}
//靠母单先生成批次模板
protected List<ProOrderWorkorderBatch> getBatchList(ProOrder proOrder){
List<ProOrderWorkorderBatch> workorderBatches = new ArrayList<>();
Long pworkOrderQua = proOrder.getQuantitySplit();//母工单数量
BaseProduct batchQua0 = proOrderWorkorderMapper.getProductInfo(proOrder);//母单标准批次产能和几合一
ProOrderWorkorderBatch workBatch = null;
while(pworkOrderQua>0){
workBatch = new ProOrderWorkorderBatch();
workBatch.setCreateBy(SecurityUtils.getUsername());
workBatch.setCreateTime(proOrder.getCreateTime());
if(batchQua0.getBatchQuaStandar().longValue()<= pworkOrderQua){
workBatch.setBatchQuantity(batchQua0.getBatchQuaStandar().longValue());
}else{
workBatch.setBatchQuantity(pworkOrderQua);
}
workorderBatches.add(workBatch);
pworkOrderQua = pworkOrderQua - batchQua0.getBatchQuaStandar().longValue();
}
//获取批次号集合
List<String> batchCodes = StringUtils.batchAutoCreate(proOrder.getFactoryCode(),
proOrder.getProdSpc(),
DateUtils.dateTime("yyyy-MM-dd",proOrder.getProductDate()),
proOrder.getAtrr2().substring(proOrder.getAtrr2().length()-1),
"0",workorderBatches.size());
for(int n=0;n<workorderBatches.size();n++){
workorderBatches.get(n).setBatchCode(batchCodes.get(n));
}
return workorderBatches;
}
/**
* 线
* 1线
@ -1362,7 +1525,8 @@ public class ProOrderServiceImpl implements IProOrderService {
List<String> lines = new ArrayList<>();
List<ProOrder> proLines = proOrderMapper.getSelectLineLevel1(proOrder);
//订单总量
BigDecimal orderQuality = new BigDecimal(proOrder.getQuantity());
proOrder.setQuantitySplit(proOrder.getQuantitySplit()==null?0L:proOrder.getQuantitySplit());
BigDecimal orderQuality = new BigDecimal(proOrder.getQuantity()).subtract(new BigDecimal(proOrder.getQuantitySplit()));
BigDecimal consumeQuality = BigDecimal.ZERO;
for(ProOrder pline:proLines){
lines.add(pline.getLineCode());
@ -1382,8 +1546,13 @@ public class ProOrderServiceImpl implements IProOrderService {
// for(int c=0;c<jsonArray.size();c++){
// System.out.println(jsonArray.getJSONArray(c).getString(1));
// }
BigDecimal a = new BigDecimal("100");
BigDecimal b = new BigDecimal("100");
System.out.println(a.compareTo(b));
// BigDecimal a = new BigDecimal("100");
// BigDecimal b = new BigDecimal("100");
// System.out.println(a.compareTo(b));
int m=1;
while(m<3){
++m;
}
System.out.println(m);
}
}

@ -123,12 +123,18 @@
SELECT powb.batch_code batchCode,
powb.batch_quantity batchQuantity
FROM pro_order_workorder_batch powb
LEFT JOIN pro_order_workorder pow
ON powb.workorder_id = pow.workorder_id
WHERE pow.workorder_id = #{workorderId} and powb.del_flag = '0'
LEFT JOIN pro_order_workorder pow ON powb.workorder_id = pow.workorder_id
WHERE pow.workorder_id = #{workorderId} and powb.del_flag = '0' and pow.del_flag = '0'
order by powb.batch_code
</select>
<select id="selectBatchCodesByIdCG" resultType="com.op.plan.domain.ProOrderWorkorderBatch">
SELECT powb.batch_code batchCode,
powb.batch_quantity batchQuantity
FROM pro_order_workorder_batch powb
LEFT JOIN pro_order_workorder pow ON powb.workorder_id = pow.workorder_id
WHERE pow.workorder_id = #{workorderId} and powb.del_flag = '2' and pow.del_flag = '2'
order by powb.batch_code
</select>
<select id="selectPackageLine" resultType="com.op.plan.domain.ProLine">
SELECT equipment_id AS 'key', equipment_name AS 'label'
FROM base_equipment
@ -222,6 +228,7 @@
order by mlp.use_man desc,pt.n desc
</select>
<insert id="insertProOrder" parameterType="ProOrder">
insert into pro_order
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -409,6 +416,25 @@
#{id}
</foreach>
</update>
<update id="updateAutoSplitWorkBatch">
update pro_order_workorder_batch set del_flag = '0'
where workorder_id in(select workorder_id from pro_order_workorder
where del_flag= '2' and belong_work_order like concat(#{orderCode},'-%'))
and del_flag='2'
</update>
<update id="updateAutoSplitWork">
update pro_order_workorder set del_flag = '0'
where del_flag= '2' and belong_work_order like concat(#{orderCode},'-%')
</update>
<update id="updateAutoSplitOrder">
update pro_order
set status = 'o2',
quantity_split = quantity
where del_flag= '0' and order_code in(
select order_code from pro_order_workorder
where del_flag= '0' and belong_work_order like concat(#{orderCode},'-%')
)
</update>
<delete id="deleteProOrderById" parameterType="String">
update pro_order
@ -424,4 +450,13 @@
#{id}
</foreach>
</delete>
<delete id="deleteAutoSplitWork">
delete from pro_order_workorder where del_flag= '2' and belong_work_order like concat(#{orderCode},'-%')
</delete>
<delete id="deleteAutoSplitWorkBatch">
delete from pro_order_workorder_batch
where workorder_id in(select workorder_id from pro_order_workorder
where del_flag= '2' and belong_work_order like concat(#{orderCode},'-%'))
and del_flag='2'
</delete>
</mapper>

@ -125,6 +125,18 @@
<if test="factoryCode != null">#{factoryCode},</if>
</trim>
</insert>
<insert id="insertWorkorderBatchs">
INSERT INTO pro_order_workorder_batch (
batch_id,workorder_id,batch_code,batch_quantity,status,
create_by,create_time,factory_code,del_flag
)VALUES
<foreach collection="list" item="d" index="index" separator=",">
(
#{d.batchId},#{d.workorderId},#{d.batchCode},#{d.batchQuantity},'0',
#{d.createBy},#{d.createTime}, #{d.factoryCode},'2'
)
</foreach>
</insert>
<update id="updateProOrderWorkorderBatch" parameterType="ProOrderWorkorderBatch">
update pro_order_workorder_batch

@ -212,12 +212,22 @@
and del_flag = '0'
</select>
<select id="selectFirWorkOrderCG" parameterType="String" resultMap="ProOrderWorkorderResult">
<include refid="selectProOrderWorkorderVo"/>
where order_id = #{id}
and del_flag = '2'
</select>
<select id="selectChildWorkOrder" parameterType="String" resultMap="ProOrderWorkorderResult">
<include refid="selectProOrderWorkorderVo"/>
WHERE parent_order = #{workorderCode}
and del_flag = '0'
</select>
<select id="selectChildWorkOrderCG" parameterType="String" resultMap="ProOrderWorkorderResult">
<include refid="selectProOrderWorkorderVo"/>
WHERE parent_order = #{workorderCode}
and del_flag = '2'
</select>
<select id="selectWorkOrderByCode" resultMap="ProOrderWorkorderResult">
<include refid="selectProOrderWorkorderVo"/>
where workorder_code = #{workorderCode}
@ -637,17 +647,30 @@
where pow.belong_work_order = #{workorderCode} and pow.del_flag = '0'
order by pow.workorder_code_sap desc
</select>
<select id="getLineProductInfo" resultType="java.lang.Long">
select mlp.efficiency efficiency
<select id="getLineProductInfo" resultType="com.op.plan.domain.ProLine">
select mlp.efficiency efficiency,
bp.dh
from mes_line_product mlp
left join base_equipment bp on mlp.line_code = bp.equipment_code
where mlp.del_flag = '0' and product_code = #{prodCode}
and mlp.line_code = #{lineCode}
and mlp.line_code = #{lineCode} and bp.del_flag = '0'
</select>
<select id="getProcessCode" resultType="java.lang.String">
select prp.process_code from pro_route_process prp
left join pro_route pr on prp.route_id = pr.route_id
where pr.route_code = #{routeCode}
</select>
<select id="getProductInfo" resultType="com.op.plan.domain.BaseProduct">
select umrez,
mvgr5_nm batchQuaStandar
from base_product
where del_flag = '0' and product_code = #{prodCode}
</select>
<select id="getQuaRatio" resultType="java.math.BigDecimal">
select umrez
from base_product
where del_flag = '0' and product_code = #{prodCode}
</select>
<insert id="createPrepareDetails">
insert into mes_prepare_detail
@ -760,7 +783,7 @@
<foreach collection="list" item="d" index="index" separator=",">
(
#{d.workorderId},#{d.workorderCode},#{d.orderId},#{d.orderCode},#{d.productCode},
#{d.productName},#{d.unit},#{d.quantitySplit},#{d.routeCode},#{d.prodLineCodeArray},
#{d.productName},#{d.unit},#{d.quantitySplit},#{d.routeCode},#{d.prodLineCode},
#{d.productDate},#{d.parentOrder},#{d.status},#{d.createBy},#{d.createTime},
#{d.prodType}, #{d.factoryCode},#{d.endFlag},'2',#{d.sortNo},
#{d.belongWorkOrder}

Loading…
Cancel
Save