收坯机看板展示数据+成品订单删除功能

master
zhaoxiaolin 10 months ago
parent cb81c6165a
commit 1801ac7122

@ -191,9 +191,26 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
totals = mesMapper.getTotalNum(boardDTO);
everys = mesMapper.getEveryNum(boardDTO);
}
/**质量看板测试开始**/
if("equ_type_spj".equals(boardDTO.getEquTypeCode())){
boardDTO.setEquTypeCode("equ_type_hf");
totals = mesMapper.getTotalNum(boardDTO);
for(BoardDTO total:totals){
total.setTotalNum(total.getTotalNum()-2);
total.setEquTypeCode(total.getEquTypeCode().replace("H","X"));
total.setEquTypeName(total.getEquTypeName().replace("烘房","收坯机"));
}
everys = mesMapper.getEveryNum(boardDTO);
for(BoardDTO every:everys){
every.setTotalNum(every.getTotalNum()-2);
every.setEquCode(every.getEquCode().replace("H","X"));
every.setEquName(every.getEquName().replace("烘房","收坯机"));
}
}
/**质量看板测试结束**/
boardMap.put("totalNum", totals);
boardMap.put("everyNum", everys);
return boardMap;
}

@ -284,5 +284,21 @@ public class ProOrderController extends BaseController {
public R syncSAPOrders() {
return proOrderService.syncSAPOrders();
}
/**
* workorderIds
*/
@RequiresPermissions("mes:pro:order:edit")
@Log(title = "关闭订单", businessType = BusinessType.OTHER)
@PostMapping("/deleteOrder/{orderIds}")
public AjaxResult deleteOrder(@PathVariable String[] orderIds) {
int m = proOrderService.deleteOrder(orderIds);
if(m==2){
//有活动中的单
return AjaxResult.error("订单拆分成的工单,已经进行生产,不允许关闭,请联系系统管理员!");
}else if(m==1){
return AjaxResult.success("订单关闭成功");
}else{
return AjaxResult.error();
}
}
}

@ -142,7 +142,8 @@ public interface ProOrderMapper {
*/
public List<ProLine> selectPackageLine();
public void updateOrderBatch(@Param("workers") List<ProOrderWorkorder> workers);
public int updateOrderBatch(@Param("workers") List<ProOrderWorkorder> workers);
public int updateCloseOrderBatch(@Param("workers") List<ProOrderWorkorder> workers);
/**
* id

@ -184,5 +184,11 @@ public interface ProOrderWorkorderMapper {
ProOrderWorkorder getSonWorkOrder(ProOrderWorkorder whiteOrder);
ProOrderWorkorder selectSonWorkOrder(String workorderCode);
List<ProOrderWorkorder> getWorkOrderByOrders(@Param("orderIds")String[] orderIds);
int deletePrepareBatch(@Param("workorders")List<String> workorders);
int deletePrepareDetailBatch(@Param("workorders")List<String> workorders);
}

@ -141,4 +141,6 @@ public interface IProOrderService {
AjaxResult getCascadeProOrder(String orderCode);
int getProSortNo(ProOrder proOrder);
int deleteOrder(String[] orderCodes);
}

@ -32,6 +32,7 @@ import com.op.system.api.RemoteSapService;
import com.op.system.api.RemoteUserService;
import com.op.system.api.domain.SysSapLog;
import com.op.system.api.domain.SysUser;
import com.op.system.api.domain.sap.SapCloseOrderQuery;
import com.op.system.api.domain.sap.SapShopOrderQuery;
import com.op.system.api.model.SapProOrder;
import org.apache.commons.lang3.time.DateFormatUtils;
@ -1084,6 +1085,87 @@ public class ProOrderServiceImpl implements IProOrderService {
}
return success();
}
@Override
@DS("#header.poolName")
@Transactional(rollbackFor = Exception.class)
public int deleteOrder(String[] orderIds) {
//可以进行订单关闭的数据
List<ProOrderWorkorder> checkWorkOrders = proOrderWorkorderMapper.getWorkOrderByOrders(orderIds);
if(checkWorkOrders.size() != orderIds.length){
return 2;
}
for(ProOrderWorkorder workorder:checkWorkOrders){
//要删除的工单id们
List<String> delteIds = new ArrayList<>();
delteIds.add(workorder.getWorkorderId());
//关闭订单用
List<String> ordercodes = new ArrayList<>();
ordercodes.add(workorder.getWorkorderCodeSap());
//删领料单用
List<String> workorderCodes = new ArrayList<>();
workorderCodes.add(workorder.getWorkorderCode());
//删除订单
List<ProOrderWorkorder> workers = new ArrayList<>();
workers.add(workorder);
ProOrderWorkorder topWork = workorder;
Boolean run = true;
while (run) {
//下级
ProOrderWorkorder sonWorkers = proOrderWorkorderMapper.selectSonWorkOrder(topWork.getWorkorderCode());
//有上级code
if (sonWorkers != null) {
workers.add(sonWorkers);
delteIds.add(sonWorkers.getWorkorderId());
ordercodes.add(sonWorkers.getWorkorderCodeSap());
workorderCodes.add(sonWorkers.getWorkorderCode());
topWork.setWorkorderCode(sonWorkers.getWorkorderCode());
} else {
run = false;
}
}
//调用sap订单关闭接口
//关闭母子订单//订单的订单编码(关闭订单暂时隐藏)
SapCloseOrderQuery sapCloseOrderQuery = new SapCloseOrderQuery();
sapCloseOrderQuery.setOrderCodes(ordercodes);
R closeR= remoteSapService.sapCloseOrder(sapCloseOrderQuery);
logger.info(workorderCodes.get(0)+"删除订单后关闭订单"+
JSONObject.toJSONString(sapCloseOrderQuery)+
closeR.getCode()+","+
closeR.getMsg()+","+
closeR.getData());
//if(closeR.getCode()==200){
String[] workorderIds = (String[]) delteIds.toArray(new String[delteIds.size()]);
if (workorderIds.length > 0) {
//删除工单(字母)pro_order_workorder
int m1 = proOrderWorkorderMapper.deleteProOrderWorkorderByWorkorderIds(workorderIds);
logger.info(workorderCodes.get(0)+"删除订单m1:"+m1);
//删除批次pro_order_workorder_batch
int m2 = proOrderWorkorderBatchMapper.deleteBatch(workorderIds);
logger.info(workorderCodes.get(0)+"删除订单m2:"+m2);
//删除领料单mes_prepare
int m3 = proOrderWorkorderMapper.deletePrepareBatch(workorderCodes);
logger.info(workorderCodes.get(0)+"删除订单m3:"+m3);
//删除领料单明细mes_prepare_detail
int m4 = proOrderWorkorderMapper.deletePrepareDetailBatch(workorderCodes);
logger.info(workorderCodes.get(0)+"删除订单m4:"+m4);
}
if (!CollectionUtils.isEmpty(workers)) {
//删除订单pro_order
int m5 = proOrderMapper.updateCloseOrderBatch(workers);
logger.info(workorderCodes.get(0)+"删除订单m5:"+m5);
}
// }else{
// logger.info(workorder.getWorkorderCode()+"删除订单后关闭订单sap返回结果"+
// JSONObject.toJSONString(closeR));
// return 0;
// }
}
return 1;
}
public static void main(String args[]){
String arrayStr = "[[\"GX01\",\"LG1\"],[\"GX01\",\"LG2\"],[\"GX02\",\"S1\"],[\"GX02\",\"S2\"],[\"GX03\",\"HF01\"],[\"GX04\",\"SPJ01\"]]";
JSONArray jsonArray = JSONArray.parseArray(arrayStr);

@ -321,7 +321,13 @@
where id = #{worker.orderId}
</foreach>
</update>
<update id="updateCloseOrderBatch">
<foreach collection="workers" item="worker" index="index" separator=";">
update pro_order set del_flag = '1',
update_time = GETDATE()
where id = #{worker.orderId}
</foreach>
</update>
<update id="updateProOrderByOrderCode" parameterType="ProOrder">
update pro_order
<trim prefix="SET" suffixOverrides=",">

@ -507,6 +507,22 @@
from pro_wet_material_plan_detail
where workorder_id = #{workorderId} and del_flag = '0'
</select>
<select id="getWorkOrderByOrders" resultType="com.op.plan.domain.ProOrderWorkorder">
select workorder_id workorderId,
workorder_code workorderCode,
order_code orderCode,
order_id orderId,
quantity_split quantitySplit,
workorder_code_sap workorderCodeSap
from pro_order_workorder pow
where pow.order_id in
<foreach item="orderId" collection="orderIds" open="(" separator="," close=")">
#{orderId}
</foreach>
and pow.status in ('w0','w1')
and pow.del_flag = '0'
</select>
<insert id="createPrepareDetails">
insert into mes_prepare_detail
@ -705,4 +721,22 @@
#{orderId}
</foreach>
</delete>
<delete id="deletePrepareBatch">
update mes_prepare
set del_flag = '1',
update_time = GETDATE()
where workorder_code in
<foreach item="workorder" collection="workorders" open="(" separator="," close=")">
#{workorder}
</foreach>
</delete>
<delete id="deletePrepareDetailBatch">
update mes_prepare_detail
set del_flag = '1',
update_time = GETDATE()
where parent_work_order in
<foreach item="workorder" collection="workorders" open="(" separator="," close=")">
#{workorder}
</foreach>
</delete>
</mapper>

Loading…
Cancel
Save