wms修改18-报工页面的sap收货按钮,和成品入库页面的过账按钮修改

master
mengjiao 1 year ago
parent ba9216c14a
commit baf41707a6

@ -48,6 +48,24 @@ public class MesReportWork extends BaseEntity {
/** 单位 */
@Excel(name = "单位")
private String unit;
private String SAPstatus;
private String SAPmessage;
public String getSAPstatus() {
return SAPstatus;
}
public void setSAPstatus(String SAPstatus) {
this.SAPstatus = SAPstatus;
}
public String getSAPmessage() {
return SAPmessage;
}
public void setSAPmessage(String SAPmessage) {
this.SAPmessage = SAPmessage;
}
/** 排产数量 */
@Excel(name = "排产数量")
@ -166,6 +184,15 @@ public class MesReportWork extends BaseEntity {
private String feedbackTimeEnd;
private String batch;
private String endReport;
private String whCode;
public String getWhCode() {
return whCode;
}
public void setWhCode(String whCode) {
this.whCode = whCode;
}
public String getEndReport() {
return endReport;

@ -409,6 +409,8 @@ public class MesReportWorkController extends BaseController {
e.printStackTrace();
}
}
/**获取母子报工记录**/
}

@ -291,4 +291,10 @@ public class OdsProcureOrderController extends BaseController {
odsProcureOrderService.OutboundPostingSAP(orderList);
return success();
}
@PostMapping("/listCKT")
public AjaxResult listCKT( BaseWarehouse baseWarehouse) {
List<BaseWarehouse> list = baseWarehouseService.selectBaseWarehouseListTWO(baseWarehouse);
return success(list);
}
}

@ -2,13 +2,17 @@ package com.op.wms.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.op.device.domain.MesReportWork;
import com.op.wms.domain.WmsProductPut;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;
import com.op.common.log.annotation.Log;
import com.op.common.log.enums.BusinessType;
import com.op.common.security.annotation.RequiresPermissions;
import com.op.wms.domain.WmsProductPut;
import com.op.wms.service.IWmsProductPutService;
import com.op.common.core.web.controller.BaseController;
import com.op.common.core.web.domain.AjaxResult;
@ -107,5 +111,23 @@ public class WmsProductPutController extends BaseController {
public AjaxResult selectWmsProductPutByWorkOrder(@PathVariable("workOrder") String workOrder){
return AjaxResult.success(wmsProductPutService.selectWmsProductPutByWorkOrder(workOrder));
}
/**
*
*
*/
@PostMapping("/WmsProductPutByWorkOrderqueryPC")
public AjaxResult WmsProductPutByWorkOrderqueryPC(@RequestBody WmsProductPut wmsProductPut){
return AjaxResult.success(wmsProductPutService.WmsProductPutByWorkOrderqueryPC(wmsProductPut));
}
@GetMapping("/getReportListSap")
public List getReportListSap(MesReportWork mesReportWork) {
List<MesReportWork> rlist = wmsProductPutService.getReportList(mesReportWork);
return rlist;
}
@PostMapping("/addReportListSap")
public AjaxResult addReportListSap(@RequestBody List<MesReportWork> mesReportWork) {
String rlist = wmsProductPutService.addReportListSap(mesReportWork);
return AjaxResult.success(rlist);
}
}

@ -2,7 +2,10 @@ package com.op.wms.mapper;
import java.util.List;
import com.op.device.domain.MesReportWork;
import com.op.wms.domain.WmsProductPut;
import org.apache.ibatis.annotations.Param;
/**
* Mapper
@ -67,4 +70,10 @@ public interface WmsProductPutMapper {
public WmsProductPut selectMesReportWork(WmsProductPut wmsProductPut);
public WmsProductPut selectWmsProductPutSAPById(String id);
List<MesReportWork> getReportList(MesReportWork mesReportWork);
List<WmsProductPut> selectWmsProductPutSAPByProDuct(String productOrder);
void updateWmsProductPutByIds(@Param("wmsProductPut") WmsProductPut wmsProductPut4,@Param("list") List<WmsProductPut> wmsProductPut2);
}

@ -1,6 +1,8 @@
package com.op.wms.service;
import java.util.List;
import com.op.device.domain.MesReportWork;
import com.op.wms.domain.WmsProductPut;
/**
@ -68,4 +70,10 @@ public interface IWmsProductPutService {
String WmsProductPutByWorkOrderConfirm(WmsProductPut wmsProductPut);
String WmsProductPutByWorkOrderConfirmSAPPosting(List<WmsProductPut> wmsProductPut);
public WmsProductPut WmsProductPutByWorkOrderqueryPC(WmsProductPut wmsProductPut);
List<MesReportWork> getReportList(MesReportWork mesReportWork);
String addReportListSap(List<MesReportWork> mesReportWork);
}

@ -10,6 +10,7 @@ import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import com.op.common.core.domain.R;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.device.domain.MesReportWork;
import com.op.system.api.RemoteSapService;
import com.op.wms.domain.*;
import com.op.wms.mapper.*;
@ -245,30 +246,161 @@ public class WmsProductPutServiceImpl implements IWmsProductPutService {
String msgs="操作完成";
for (WmsProductPut wmsProductPut1:
wmsProductPut) {
WmsProductPut wmsProductPut2= wmsProductPutMapper.selectWmsProductPutSAPById(wmsProductPut1.getId());
List<Map<String, Object>> mapList = new ArrayList<>();
WmsProductPut wmsProductPutSAPById= wmsProductPutMapper.selectWmsProductPutSAPById(wmsProductPut1.getId());
if (wmsProductPutSAPById!=null){
List<WmsProductPut> wmsProductPut2= wmsProductPutMapper.selectWmsProductPutSAPByProDuct(wmsProductPutSAPById.getProductOrder());
if (wmsProductPut2.size()>0){
List<Map<String, Object>> mapList = new ArrayList<>();
Map<String, Object> map = new HashMap<>();
for (WmsProductPut wmsProductPut3:
wmsProductPut2) {
map.put("AUFNR",wmsProductPut3.getProductOrder());
map.put("WERKS",wmsProductPut3.getFactoryCode());
map.put("LGORT",wmsProductPut3.getWhCode());
map.put("QUANTITY",wmsProductPut3.getPutQuantity());
map.put("ERFME",wmsProductPut3.getUnitOfMeasure());
map.put("BATCH",wmsProductPut3.getBatchNumber());
map.put("HSDAT",wmsProductPut3.getProductDate());
mapList.add(map);
}
R result= remoteSapService.sapOrderReceipt(mapList);
int code= result.getCode();
String msg= result.getMsg();
WmsProductPut wmsProductPut4=new WmsProductPut();
wmsProductPut4.setSapMessage(msg);
if (code==200) {//过账成功
String date= (String) result.getData();
wmsProductPut4.setSapProof(date);
wmsProductPut4.setSapStatus("1");
}else {
wmsProductPut4.setSapProof("");
wmsProductPut4.setSapStatus("2");
}
wmsProductPutMapper.updateWmsProductPutByIds(wmsProductPut4,wmsProductPut2);
}
}
}
return msgs;
}
@Override
public WmsProductPut WmsProductPutByWorkOrderqueryPC(WmsProductPut wmsProductPut) {
DynamicDataSourceContextHolder.push("ds_" +wmsProductPut.getFactoryCode());
WmsProductPut wmsProductPut1= wmsProductPutMapper.selectMesReportWork(wmsProductPut);
return wmsProductPut1;
}
@Override
@DS("#header.poolName")
public List<MesReportWork> getReportList(MesReportWork mesReportWork) {
List<MesReportWork> rlist = wmsProductPutMapper.getReportList(mesReportWork);;
return rlist;
}
@Override
@DS("#header.poolName")
public String addReportListSap(List<MesReportWork> mesReportWorks) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
Date date = new Date();
String formattedDate = dateFormat.format(date);//批次
//List<WmsProductPut> wmsProductPutList= new ArrayList<>();
for (MesReportWork mesReportWork:
mesReportWorks) {
WmsProductPut wmsProductPutk=new WmsProductPut();
//wms_product_put
mesReportWork.setId(IdUtils.fastSimpleUUID());
wmsProductPutk.setId(mesReportWork.getId());
wmsProductPutk.setWorkOrder(mesReportWork.getReportCode());
wmsProductPutk.setFactoryCode(mesReportWork.getFactoryCode());
wmsProductPutk.setWhCode(mesReportWork.getWhCode());//仓库编码
wmsProductPutk.setProductName(mesReportWork.getProductName());
wmsProductPutk.setProductCode(mesReportWork.getProductCode());
wmsProductPutk.setProductOrder(mesReportWork.getWorkorderCodeSap());
wmsProductPutk.setPlanQuantity(mesReportWork.getQuantityFeedback());
wmsProductPutk.setPutQuantity(mesReportWork.getQuantityQualified());
wmsProductPutk.setStatus("1");
wmsProductPutk.setSapStatus("0");
wmsProductPutk.setBatchNumber(mesReportWork.getBatch());//
wmsProductPutk.setAttr3(formattedDate);//
wmsProductPutk.setCreateBy(mesReportWork.getCreateBy());
wmsProductPutk.setCreateTime(new Date());
wmsProductPutk.setUnitOfMeasure(mesReportWork.getUnit());
wmsProductPutk.setProductDate(mesReportWork.getProductDate());
wmsProductPutMapper.insertWmsProductPut(wmsProductPutk);
//入库记录
WmsProductPutRecords wmsProductPutRecords=new WmsProductPutRecords();
wmsProductPutRecords.setWorkOrder(mesReportWork.getReportCode());
wmsProductPutRecords.setProductOrder(mesReportWork.getWorkorderCodeSap());
wmsProductPutRecords.setProductName(mesReportWork.getProductName());
wmsProductPutRecords.setProductCode(mesReportWork.getProductCode());
wmsProductPutRecords.setWhCode(mesReportWork.getWhCode());//仓库编码
wmsProductPutRecords.setId(IdUtils.fastSimpleUUID());
wmsProductPutRecords.setNumber(mesReportWork.getQuantityQualified().toString());
wmsProductPutRecords.setCreateBy(mesReportWork.getCreateBy());
wmsProductPutRecords.setCreateTime(new Date());
wmsProductPutRecordsMapper.insertWmsProductPutRecords(wmsProductPutRecords);
WmsFpStorageNews wmsFpStorageNews=new WmsFpStorageNews();
wmsFpStorageNews.setWhCode(mesReportWork.getWhCode());//仓库编码
// wmsFpStorageNews.setWlCode(mesReportWork.getWlCode());
wmsFpStorageNews.setStorageType("成品");
wmsFpStorageNews.setProductCode(mesReportWork.getProductCode());
wmsFpStorageNews.setProductName(mesReportWork.getProductName());
wmsFpStorageNews.setFactoryCode(mesReportWork.getFactoryCode());
wmsFpStorageNews.setActiveFlag("1");
wmsFpStorageNews.setUserDefined1(mesReportWork.getUnit());
List<WmsFpStorageNews> wmsFpStorageNewsList= wmsFpStorageNewsMapper.selectWmsFpStorageNewsList(wmsFpStorageNews);
wmsFpStorageNews.setStorageId(IdUtils.fastSimpleUUID());
wmsFpStorageNews.setAmount(mesReportWork.getQuantityQualified());
wmsFpStorageNews.setCreateBy(mesReportWork.getCreateBy());
wmsFpStorageNews.setCreateTime(new Date());
if (wmsFpStorageNewsList.size()>0){
WmsFpStorageNews wmsFpStorageNews1= wmsFpStorageNewsList.get(0);
BigDecimal amount= wmsFpStorageNews1.getAmount();
BigDecimal amountAdd= amount.add(wmsFpStorageNews.getAmount());
wmsFpStorageNews1.setAmount(amountAdd);
wmsFpStorageNewsMapper.updateWmsFpStorageNews(wmsFpStorageNews1);
}else {
wmsFpStorageNewsMapper.insertWmsFpStorageNews(wmsFpStorageNews);
}
}
List<Map<String, Object>> mapList = new ArrayList<>();
for (MesReportWork mesReportWork:
mesReportWorks) {
Map<String, Object> map = new HashMap<>();
map.put("AUFNR",wmsProductPut2.getProductOrder());
map.put("WERKS",wmsProductPut2.getFactoryCode());
map.put("LGORT",wmsProductPut2.getWhCode());
map.put("QUANTITY",wmsProductPut2.getPutQuantity());
map.put("ERFME",wmsProductPut2.getUnitOfMeasure());
map.put("BATCH",wmsProductPut2.getAttr3());
map.put("HSDAT",wmsProductPut2.getProductDate());
map.put("AUFNR",mesReportWork.getWorkorderCodeSap());
map.put("WERKS",mesReportWork.getFactoryCode());
map.put("LGORT",mesReportWork.getWhCode());
map.put("QUANTITY",mesReportWork.getQuantityQualified());
map.put("ERFME",mesReportWork.getUnit());
map.put("BATCH",mesReportWork.getBatch());
map.put("HSDAT",mesReportWork.getProductDate());
mapList.add(map);
R result= remoteSapService.sapOrderReceipt(mapList);
int code= result.getCode();
String msg= result.getMsg();
wmsProductPut2.setSapMessage(msg);
}
//过账
R result=remoteSapService.sapOrderReceipt(mapList);
int code= result.getCode();
String msg= result.getMsg();
for (MesReportWork mesReportWork:
mesReportWorks) {
WmsProductPut wmsProductPut2=new WmsProductPut();
wmsProductPut2.setId(mesReportWork.getId());
wmsProductPut2.setSapMessage(msg);
if (code==200) {//过账成功
String date= (String) result.getData();
wmsProductPut2.setSapProof(date);
String tem= (String) result.getData();
wmsProductPut2.setSapProof(tem);
wmsProductPut2.setSapStatus("1");
}else {
wmsProductPut2.setSapStatus("2");
}
wmsProductPutMapper.updateWmsProductPut(wmsProductPut2);
}
return msgs;
String SUCCESS="操作完成";
return SUCCESS;
}
}

@ -222,7 +222,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectMesReportWork" resultMap="WmsProductPutResult">
SELECT
mes_report_work.report_code work_order,
pro_order_workorder.order_code product_order,
pro_order_workorder.workorder_code_sap product_order,
mes_report_work.product_code,
mes_report_work.product_name,
mes_report_work.unit unit_of_measure,
@ -288,4 +288,91 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND wms_product_put.status= '1'
AND wms_product_put.SAP_status IN ( 0, 2 )
</select>
<select id="getReportList" resultType="com.op.device.domain.MesReportWork">
SELECT
mes_report_work.id,
mes_report_work.workorder_code workorderCode,
mes_report_work.report_code reportCode,
mes_report_work.batch,
mes_report_work.quantity_feedback quantityFeedback,
mes_report_work.quantity_feedback quantityQualified,
mes_report_work.unit,
mes_report_work.work_time workTime,
mes_report_work.use_man useMan,
pro_order_workorder.workorder_code_sap workorderCodeSap,
mes_report_work.create_time createTime,
mes_report_work.product_code productCode,
mes_report_work.product_name productName,
pro_order_workorder.product_date productDate ,
wms_product_put.SAP_status SAPstatus,
wms_product_put.SAP_message SAPmessage
FROM
mes_report_work
LEFT JOIN pro_order_workorder ON mes_report_work.workorder_code= pro_order_workorder.workorder_code
AND pro_order_workorder.del_flag= '0'
LEFT JOIN wms_product_put ON wms_product_put.work_order=mes_report_work.report_code AND
wms_product_put.batch_number=mes_report_work.batch
WHERE
mes_report_work.del_flag= '0'
AND mes_report_work.workorder_code = #{workorderCode}
AND mes_report_work.parent_order = '0'
ORDER BY
mes_report_work.end_report
</select>
<select id="selectWmsProductPutSAPByProDuct" parameterType="String" resultMap="WmsProductPutResult">
SELECT DISTINCT
wms_product_put.id,
wms_product_put.work_order,
wms_product_put.factory_code,
wms_product_put.product_order,
wms_product_put.wh_code,
wms_product_put.wa_code,
wms_product_put.wl_code,
wms_product_put.product_name,
wms_product_put.product_code,
wms_product_put.product_sort,
wms_product_put.specification,
wms_product_put.unit_of_measure,
wms_product_put.plan_quantity,
wms_product_put.put_quantity,
wms_product_put.status,
wms_product_put.SAP_status,
wms_product_put.SAP_proof,
wms_product_put.SAP_message,
wms_product_put.put_date,
wms_product_put.batch_number,
wms_product_put.attr3,
wms_product_put.attr4,
wms_product_put.attr5,
wms_product_put.attr6,
wms_product_put.attr7,
wms_product_put.attr8,
wms_product_put.attr9,
wms_product_put.attr10,
wms_product_put.create_by,
wms_product_put.create_time,
wms_product_put.update_by,
wms_product_put.update_time ,
pro_order_workorder.product_date
FROM
wms_product_put
LEFT JOIN pro_order_workorder ON pro_order_workorder.workorder_code_sap=wms_product_put.product_order
WHERE wms_product_put.product_order = #{productOrder}
AND wms_product_put.status= '1'
AND wms_product_put.SAP_status IN ( 0, 2 )
</select>
<update id="updateWmsProductPutByIds" parameterType="WmsProductPut">
update wms_product_put
set
SAP_status = #{wmsProductPut.sapStatus},
SAP_proof = #{wmsProductPut.sapProof},
SAP_message = #{wmsProductPut.sapMessage}
where
id in
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
#{item.id}
</foreach>
</update>
</mapper>

Loading…
Cancel
Save