Compare commits

...

3 Commits

@ -3,6 +3,7 @@ package com.op.mes.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.op.mes.domain.MesPrepare;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@ -113,4 +114,16 @@ public class MesPrepareDetailController extends BaseController {
public AjaxResult remove(@PathVariable String[] recordIds) {
return toAjax(mesPrepareDetailService.deleteMesPrepareDetailByRecordIds(recordIds));
}
/**
*
*
* @return
*/
@RequiresPermissions("mes:prepareDetail:export")
@Log(title = "mes备料打印生产物料", businessType = BusinessType.EXPORT)
@GetMapping("/printBatchPrepare")
public AjaxResult printBatchPrepare(MesPrepare params) {
return AjaxResult.success(mesPrepareDetailService.printBatchPrepare(params));
}
}

@ -74,4 +74,6 @@ public interface MesPrepareDetailMapper {
List<MesPrepareDetail> selectPrintPrepareDetailList(MesPrepareDetail dto);
List<MesPrepareDetail> selectPreDetailHzList(MesPrepareDetail qodetail);
List<MesPrepareDetail> selectPrintPrepareDetailListByOrderCodes(@Param("list") List<String> orderCodes);
}

@ -251,4 +251,6 @@ public interface MesReportWorkMapper {
BigDecimal selectWmsProductPut(MesReportWork mesReportWork1);
List<Map<String,Object>> selectRecordDnbInstantByTime (Map<String, Object> query);
void updateAttr2AndRspos(MesReportWorkConsume params);
}

@ -3,6 +3,7 @@ package com.op.mes.service;
import java.util.List;
import com.op.common.core.web.domain.AjaxResult;
import com.op.mes.domain.MesPrepare;
import com.op.mes.domain.MesPrepareDetail;
/**
@ -68,4 +69,6 @@ public interface IMesPrepareDetailService {
AjaxResult printPrepareByCode(String workorderCode,String recoil);
AjaxResult printPrepareXByCode(String productDate);
List<MesPrepareDetail> printBatchPrepare(MesPrepare params);
}

@ -151,4 +151,13 @@ public class MesPrepareDetailServiceImpl implements IMesPrepareDetailService {
printPrepareVo.setMesPrepareDetailList(mesPrepareDetailList);
return AjaxResult.success(printPrepareVo);
}
@Override
@DS("#header.poolName")
public List<MesPrepareDetail> printBatchPrepare(MesPrepare params) {
//获取今天的领料单
List<MesPrepare> prepareList = mesPrepareMapper.selectMesPrepareList(params);
List<String> orderCodes = prepareList.stream().map(MesPrepare::getWorkorderCode).collect(Collectors.toList());
return mesPrepareDetailMapper.selectPrintPrepareDetailListByOrderCodes(orderCodes);
}
}

@ -254,9 +254,23 @@ public class MesReportWorkConsumeServiceImpl implements IMesReportWorkConsumeSer
logger.info(workorder.getWorkorderCode()
+ "报工损耗物料组件修改结果:" + JSONObject.toJSONString(bomUpdateR));
if(bomUpdateR.getCode() == 200){
//attr2 0->1组件完成修改
int f = mesReportWorkMapper.updateAttr2(workorder);
logger.info("组件修改完成:"+f);
if (bomUpdateR.getData() != null) {
Map<String,Object> data = (Map<String, Object>) bomUpdateR.getData();
if (data.get("items") != null) {
List<Map<String,String>> items = (List<Map<String,String>>) data.get("items");
for (Map<String,String> item : items) {
MesReportWorkConsume params = new MesReportWorkConsume();
params.setMaterialCode(item.get("matnr"));
params.setWorkorderCode(workorder.getWorkorderCode());
params.setRspos(item.get("code"));
mesReportWorkMapper.updateAttr2AndRspos(params);
}
//attr2 0->1组件完成修改
// int f = mesReportWorkMapper.updateAttr2(workorder);
logger.info("组件修改完成:");
}
}
}
return bomUpdateR;
}

@ -215,4 +215,34 @@
#{recordId}
</foreach>
</delete>
<select id="selectPrintPrepareDetailListByOrderCodes" parameterType="com.op.mes.domain.MesPrepareDetail"
resultType="com.op.mes.domain.MesPrepareDetail">
select
mp.workorder_name workorderCode,
mpd.material_code materialCode,
mpd.material_name materialName,
mpd.quantity,
mpd.unit,
mpd.status,
mpd.fund_quanlity fundQuanlity,
mpd.factory_code factoryCode,
mpd.recoil,
ow.product_date productDate,
ow.prod_line_code prodLineCode,
ROW_NUMBER() OVER (ORDER BY mpd.recoil DESC) AS xh
from pro_order_workorder ow
left join mes_prepare mp on ow.workorder_code = mp.workorder_code
left join mes_prepare_detail mpd on mp.prepare_id = mpd.prepare_id
where
ow.del_flag = '0' and mpd.recoil = '' and mp.del_flag = '0' and mpd.del_flag = '0'
and ow.belong_work_order in
<foreach item="orderCode" collection="list" open="(" separator="," close=")">
#{orderCode}
</foreach>
order by mpd.recoil
</select>
</mapper>

@ -1844,4 +1844,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ORDER BY
collect_time ASC;
</select>
<update id="updateAttr2AndRspos" parameterType="com.op.mes.domain.MesReportWorkConsume">
update mes_report_work_consume
set attr2 = '1', rspos = #{rspos}
where parent_order = #{workorderCode} and attr1= '1' and material_code = #{materialCode} and attr2 = '0'
</update>
</mapper>

@ -628,6 +628,8 @@ public class SapOrderServiceImpl implements SapOrderService {
@Override
public R shopOrderBomUpdate(List<Map<String, Object>> mapList) {
Map<String,Object> result = new HashMap<>();
List<Map<String,String>> items = new ArrayList<>();
int successNum = 0;
int failureNum = 0;
StringBuilder successMsg = new StringBuilder();
@ -661,6 +663,10 @@ public class SapOrderServiceImpl implements SapOrderService {
if (Constants.SUCCESS.equals(Integer.parseInt(RETCODE))){
successNum++;
successMsg.append("<br/>" + successNum + "、物料:"+m.get("P_MATNR")+L_MSG);
Map<String, String> map = new HashMap<>();
map.put("matnr", (String) m.get("P_MATNR"));
map.put("code", func.getExportParameterList().getString("NEXT_RSPOS"));
items.add(map);
}else {
failureNum++;
failureMsg.append("<br/>" + failureNum + "、物料 " +m.get("P_MATNR")+L_MSG);
@ -678,7 +684,9 @@ public class SapOrderServiceImpl implements SapOrderService {
} else {
successMsg.insert(0, "恭喜您添加SAP组件成功共 " + successNum + " 条,数据如下:");
}
return R.ok(successMsg);
result.put("msg",successMsg);
result.put("items",items);
return R.ok(result);
}

Loading…
Cancel
Save