优化入库,将自动报工拆分至入库完成处理

This commit is contained in:
zj
2026-01-28 08:45:16 +08:00
parent 55fd40718f
commit 3a8cd0141b
17 changed files with 1369 additions and 20 deletions

View File

@@ -36,4 +36,9 @@ public class ToErpApiController {
public void callbackTransferBill() {
toErpService.callbackTransferBill();
}
@Scheduled(fixedDelay = 30000)
public void callbackProduction() {
toErpService.callbackProduction();
}
}

View File

@@ -19,4 +19,6 @@ public interface IToErpService {
AjaxResult createWorkshopInboundOrder(BasProduct basProduct,String erpBill);
AjaxResult getInCode(BasProductCode basProductCode);
void callbackProduction();
}

View File

@@ -9,7 +9,9 @@ import com.ruoyi.bas.BasProduct.service.IBasProductService;
import com.ruoyi.bas.BasProductCode.domain.BasProductCode;
import com.ruoyi.bas.basJobId.service.IBasJobIdService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.in.erp.domain.ProductionCallback;
import com.ruoyi.in.erp.domain.TransferBillCallback;
import com.ruoyi.in.erp.service.IProductionCallbackService;
import com.ruoyi.in.erp.service.ITransferBillCallbackService;
import com.ruoyi.log.domain.RequestLog;
import com.ruoyi.log.service.IRequestLogService;
@@ -29,6 +31,8 @@ public class ToErpServiceImpl implements IToErpService {
@Autowired
private ITransferBillCallbackService transferBillCallbackService;
@Autowired
private IProductionCallbackService productionCallbackService;
@Autowired
private IBasJobIdService basJobIdService;
@Autowired
private IRequestLogService requestLogService;
@@ -41,19 +45,88 @@ public class ToErpServiceImpl implements IToErpService {
public void callbackTransferBill() {
TransferBillCallback param = new TransferBillCallback();
param.setStatus("0");
//List<TransferBillCallback> list = transferBillCallbackService.selectTransferBillCallbackList(param);
List<TransferBillCallback> list = transferBillCallbackService.getTopMsg(param);
for (TransferBillCallback transferBillCallback : list) {
if(list.size()>0){
TransferBillCallback callback = list.get(0);
//todo 请求其他出入库单回传接口
AjaxResult otherInOutboundOrder = createOtherInOutboundOrder(transferBillCallback);
AjaxResult otherInOutboundOrder = createOtherInOutboundOrder(callback);
if (otherInOutboundOrder.isSuccess()) {
transferBillCallback.setStatus("1");
transferBillCallback.setFinishTime(DateUtil.formatDateTime(new Date()));
transferBillCallbackService.updateTransferBillCallback(transferBillCallback);
callback.setStatus("1");
callback.setFinishTime(DateUtil.formatDateTime(new Date()));
transferBillCallbackService.updateTransferBillCallback(callback);
}else{
callback.setStatus("2");
callback.setFinishTime(DateUtil.formatDateTime(new Date()));
transferBillCallbackService.updateTransferBillCallback(callback);
}
}
}
@Override
public void callbackProduction() {
List<ProductionCallback> list = productionCallbackService.getTopMsg("0");
if(list.size()>0){
ProductionCallback productionCallback = list.get(0);
AjaxResult ajaxResult = createProductionCallback(productionCallback);
if (ajaxResult.isSuccess()) {
productionCallback.setStatus("1");
productionCallback.setReturnCode("0");
productionCallback.setReturnMsg(ajaxResult.get("msg").toString());
productionCallbackService.updateProductionCallback(productionCallback);
}else{
productionCallback.setStatus("2");
productionCallback.setReturnCode("1");
productionCallback.setReturnMsg(ajaxResult.get("msg").toString());
productionCallbackService.updateProductionCallback(productionCallback);
}
}
}
private AjaxResult createProductionCallback(ProductionCallback productionCallback) {
ErpInterfaceParam<WipTransferDoc> param = new ErpInterfaceParam<>();
ErpStdData<WipTransferDoc> erpStdData = new ErpStdData<>();
ErpParameter<WipTransferDoc> objectErpParameter = new ErpParameter<>();
ArrayList<WipTransferDocD> list = new ArrayList<WipTransferDocD>();
WipTransferDoc wipTransferDoc = new WipTransferDoc();
wipTransferDoc.setDOC_NO(basJobIdService.getJobIdBy("5C41"));
wipTransferDoc.setDOC_ID_DOC_CODE("5C41");
wipTransferDoc.setDOC_DATE(DateUtil.formatDateTime(new Date()));
wipTransferDoc.setSOURCE_ID_WORK_CENTER_WORK_CENTER_CODE("QC06");
wipTransferDoc.setFROM_ADMIN_UNIT_ID_ADMIN_UNIT_CODE("EF08G");
wipTransferDoc.setFROM_ADMIN_UNIT_ID_START_DATE(DateUtil.formatDateTime(new Date()));
wipTransferDoc.setOwner_Dept_ADMIN_UNIT_CODE("EF08G");
wipTransferDoc.setOwner_Dept_START_DATE(DateUtil.formatDateTime(new Date()));
wipTransferDoc.setOwner_Emp_EMPLOYEE_CODE("EF08G");
String docNo = requestLogService.getRequestLogDoc(TO_ERP_URL,productionCallback.getBillNo(), productionCallback.getProductId() , "获取工艺单号", "wms", "erp");
if("".equals(docNo) || docNo == null) {
return AjaxResult.error();
}
WipTransferDocD wipTransferDocD = new WipTransferDocD();
wipTransferDocD.setMO_ID_DOC_NO(docNo);
wipTransferDocD.setTO_ADMIN_UNIT_ID_START_DATE(DateUtil.formatDateTime(new Date()));
wipTransferDocD.setQTY("1");
wipTransferDocD.setITEM_ID_ITEM_CODE(productionCallback.getProductId());
wipTransferDocD.setITEM_NAME(productionCallback.getProductName());
wipTransferDocD.setITEM_SPECIFICATION(productionCallback.getSpec());
wipTransferDocD.setSOURCE_ID_WAREHOUSE_WAREHOUSE_CODE("C041-1");
wipTransferDocD.setFROM_MO_ROUTING_D_ID_SequenceNumber(1);
wipTransferDocD.setFROM_MO_ROUTING_D_ID_Parent_MO_ID_DOC_NO(docNo);
list.add(wipTransferDocD);
wipTransferDoc.setWIP_TRANSFER_DOC_D(list);
objectErpParameter.setDatas(List.of(wipTransferDoc));
erpStdData.setParameter(objectErpParameter);
param.setStd_data(erpStdData);
RequestLog requestLog = requestLogService.getRequestLogGd(TO_ERP_URL, JSONUtil.toJsonStr(param), "创建工艺单","wms","erp");
if(requestLog != null && "1".equals(requestLog.getIsSuccessful())){
return AjaxResult.success(requestLog.getResponseBody());
}else{
return AjaxResult.error(requestLog.getResponseBody());
}
}
@Override
public AjaxResult createWorkshopInboundOrder(BasProduct basProduct,String erpBill) {
ErpInterfaceParam<WipTransferDoc> param = new ErpInterfaceParam<>();
@@ -111,6 +184,8 @@ public class ToErpServiceImpl implements IToErpService {
}
public AjaxResult createOtherInOutboundOrder(TransferBillCallback transferBillCallback) {
ErpInterfaceParam<ErpInOutBoundOrder> param = new ErpInterfaceParam<>();
ErpStdData<ErpInOutBoundOrder> erpStdData = new ErpStdData<>();

View File

@@ -190,7 +190,7 @@ public class ToWmsServiceImpl implements IToWmsService {
}
//todo 创建工艺入库单
//注释该部分用于处理异常报工无法正常入库的工单任务
//注释该部分,优化为先入库后报工,堆垛机完成插入数据
// if ("2".equals(requestEnter.getFloor())){
// AjaxResult workshopInboundOrder = toErpService.createWorkshopInboundOrder(basProduct,erpBill);
// if (!workshopInboundOrder.isSuccess()){
@@ -341,7 +341,6 @@ public class ToWmsServiceImpl implements IToWmsService {
StringBuilder stringBuilder = new StringBuilder();
switch (wmsJobRequest.getWmsType()) {
case "1":
if (StrUtil.isEmpty(wmsJobRequest.getTaskNo())) {
return AjaxResult.error("任务号不能为空");
}

View File

@@ -0,0 +1,93 @@
package com.ruoyi.in.erp.controller;
import java.util.List;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.in.erp.domain.ProductionCallback;
import com.ruoyi.in.erp.service.IProductionCallbackService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* ProductionCallbackController
*
* @author ruoyi
* @date 2026-01-27
*/
@RestController
@RequestMapping("/erp/productionCallback")
public class ProductionCallbackController extends BaseController
{
@Autowired
private IProductionCallbackService productionCallbackService;
/**
* 查询ProductionCallback列表
*/
// @PreAuthorize("@ss.hasPermi('ProductionCallback:ProductionCallback:list')")
@GetMapping("/list")
public TableDataInfo list(ProductionCallback productionCallback)
{
startPage();
List<ProductionCallback> list = productionCallbackService.selectProductionCallbackList(productionCallback);
return getDataTable(list);
}
/**
* 导出ProductionCallback列表
*/
// @PreAuthorize("@ss.hasPermi('ProductionCallback:ProductionCallback:export')")
@Log(title = "ProductionCallback", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ProductionCallback productionCallback)
{
List<ProductionCallback> list = productionCallbackService.selectProductionCallbackList(productionCallback);
ExcelUtil<ProductionCallback> util = new ExcelUtil<ProductionCallback>(ProductionCallback.class);
util.exportExcel(response, list, "ProductionCallback数据");
}
/**
* 获取ProductionCallback详细信息
*/
// @PreAuthorize("@ss.hasPermi('ProductionCallback:ProductionCallback:query')")
@GetMapping(value = "/{trayCode}")
public AjaxResult getInfo(@PathVariable("trayCode") String trayCode)
{
return success(productionCallbackService.selectProductionCallbackByTrayCode(trayCode));
}
/**
* 修改ProductionCallback
*/
// @PreAuthorize("@ss.hasPermi('ProductionCallback:ProductionCallback:edit')")
@Log(title = "ProductionCallback", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ProductionCallback productionCallback)
{
return toAjax(productionCallbackService.updateProductionCallbackMsg(productionCallback));
}
/**
* 删除ProductionCallback
*/
// @PreAuthorize("@ss.hasPermi('ProductionCallback:ProductionCallback:remove')")
@Log(title = "ProductionCallback", businessType = BusinessType.DELETE)
@DeleteMapping("/{trayCodes}")
public AjaxResult remove(@PathVariable String[] trayCodes)
{
return toAjax(productionCallbackService.deleteProductionCallbackByTrayCodes(trayCodes));
}
}

View File

@@ -38,7 +38,7 @@ public class TransferBillCallbackController extends BaseController
/**
* 查询调拨单回传列表
*/
@PreAuthorize("@ss.hasPermi('in:transfer:list')")
// @PreAuthorize("@ss.hasPermi('in:transfer:list')")
@GetMapping("/list")
public TableDataInfo list(TransferBillCallback transferBillCallback)
{
@@ -50,7 +50,7 @@ public class TransferBillCallbackController extends BaseController
/**
* 导出调拨单回传列表
*/
@PreAuthorize("@ss.hasPermi('in:transfer:export')")
// @PreAuthorize("@ss.hasPermi('in:transfer:export')")
@Log(title = "调拨单回传", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TransferBillCallback transferBillCallback)
@@ -63,7 +63,7 @@ public class TransferBillCallbackController extends BaseController
/**
* 获取调拨单回传详细信息
*/
@PreAuthorize("@ss.hasPermi('in:transfer:query')")
// @PreAuthorize("@ss.hasPermi('in:transfer:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
@@ -73,7 +73,7 @@ public class TransferBillCallbackController extends BaseController
/**
* 新增调拨单回传
*/
@PreAuthorize("@ss.hasPermi('in:transfer:add')")
// @PreAuthorize("@ss.hasPermi('in:transfer:add')")
@Log(title = "调拨单回传", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TransferBillCallback transferBillCallback)
@@ -84,7 +84,7 @@ public class TransferBillCallbackController extends BaseController
/**
* 修改调拨单回传
*/
@PreAuthorize("@ss.hasPermi('in:transfer:edit')")
// @PreAuthorize("@ss.hasPermi('in:transfer:edit')")
@Log(title = "调拨单回传", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TransferBillCallback transferBillCallback)
@@ -95,7 +95,7 @@ public class TransferBillCallbackController extends BaseController
/**
* 删除调拨单回传
*/
@PreAuthorize("@ss.hasPermi('in:transfer:remove')")
// @PreAuthorize("@ss.hasPermi('in:transfer:remove')")
@Log(title = "调拨单回传", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)

View File

@@ -0,0 +1,94 @@
package com.ruoyi.in.erp.domain;
public class ProductionCallback {
private String trayCode;
private String billNo;
private String productId;
private String productName;
private String spec;
private String unit;
private String status;
private String createTime;
private String returnCode;
private String returnMsg;
public String getTrayCode() {
return trayCode;
}
public void setTrayCode(String trayCode) {
this.trayCode = trayCode;
}
public String getBillNo() {
return billNo;
}
public void setBillNo(String billNo) {
this.billNo = billNo;
}
public String getProductId() {
return productId;
}
public void setProductId(String productId) {
this.productId = productId;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getSpec() {
return spec;
}
public void setSpec(String spec) {
this.spec = spec;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public String getReturnCode() {
return returnCode;
}
public void setReturnCode(String returnCode) {
this.returnCode = returnCode;
}
public String getReturnMsg() {
return returnMsg;
}
public void setReturnMsg(String returnMsg) {
this.returnMsg = returnMsg;
}
}

View File

@@ -0,0 +1,56 @@
package com.ruoyi.in.erp.mapper;
import com.ruoyi.in.erp.domain.ProductionCallback;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 工艺入库回传Mapper接口
*
* @author ruoyi
* @date 2025-09-17
*/
public interface ProductionCallbackMapper
{
List<ProductionCallback> getTopMsg(@Param("status") String status);
void updateProductionCallback(ProductionCallback productionCallback);
void insertProductionCallback(ProductionCallback productionCallback);
/**
* 查询ProductionCallback
*
* @param trayCode ProductionCallback主键
* @return ProductionCallback
*/
public ProductionCallback selectProductionCallbackByTrayCode(String trayCode);
/**
* 查询ProductionCallback列表
*
* @param productionCallback ProductionCallback
* @return ProductionCallback集合
*/
public List<ProductionCallback> selectProductionCallbackList(ProductionCallback productionCallback);
/**
* 删除ProductionCallback
*
* @param trayCode ProductionCallback主键
* @return 结果
*/
public int deleteProductionCallbackByTrayCode(String trayCode);
/**
* 批量删除ProductionCallback
*
* @param trayCodes 需要删除的数据主键集合
* @return 结果
*/
public int deleteProductionCallbackByTrayCodes(String[] trayCodes);
int updateProductionCallbackMsg(ProductionCallback productionCallback);
}

View File

@@ -0,0 +1,54 @@
package com.ruoyi.in.erp.service;
import com.ruoyi.in.erp.domain.ProductionCallback;
import java.util.List;
/**
* 工艺入库回传Service接口
*
* @author ruoyi
* @date 2025-09-17
*/
public interface IProductionCallbackService {
List<ProductionCallback> getTopMsg(String status);
void updateProductionCallback(ProductionCallback productionCallback);
void insertProductionCallback(ProductionCallback productionCallback);
/**
* 查询ProductionCallback
*
* @param trayCode ProductionCallback主键
* @return ProductionCallback
*/
public ProductionCallback selectProductionCallbackByTrayCode(String trayCode);
/**
* 查询ProductionCallback列表
*
* @param productionCallback ProductionCallback
* @return ProductionCallback集合
*/
public List<ProductionCallback> selectProductionCallbackList(ProductionCallback productionCallback);
/**
* 批量删除ProductionCallback
*
* @param trayCodes 需要删除的ProductionCallback主键集合
* @return 结果
*/
public int deleteProductionCallbackByTrayCodes(String[] trayCodes);
/**
* 删除ProductionCallback信息
*
* @param trayCode ProductionCallback主键
* @return 结果
*/
public int deleteProductionCallbackByTrayCode(String trayCode);
int updateProductionCallbackMsg(ProductionCallback productionCallback);
}

View File

@@ -0,0 +1,92 @@
package com.ruoyi.in.erp.service.impl;
import com.ruoyi.in.erp.domain.ProductionCallback;
import com.ruoyi.in.erp.mapper.ProductionCallbackMapper;
import com.ruoyi.in.erp.service.IProductionCallbackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 工艺入库回传Service业务层处理
*
* @author ruoyi
* @date 2025-09-17
*/
@Service
public class ProductionCallbackServiceImpl implements IProductionCallbackService {
@Autowired
private ProductionCallbackMapper productionCallbackMapper;
@Override
public List<ProductionCallback> getTopMsg(String status) {
return productionCallbackMapper.getTopMsg(status);
}
@Override
public void updateProductionCallback(ProductionCallback productionCallback) {
productionCallbackMapper.updateProductionCallback(productionCallback);
}
@Override
public void insertProductionCallback(ProductionCallback productionCallback) {
productionCallbackMapper.insertProductionCallback(productionCallback);
}
/**
* 查询ProductionCallback
*
* @param trayCode ProductionCallback主键
* @return ProductionCallback
*/
@Override
public ProductionCallback selectProductionCallbackByTrayCode(String trayCode)
{
return productionCallbackMapper.selectProductionCallbackByTrayCode(trayCode);
}
/**
* 查询ProductionCallback列表
*
* @param productionCallback ProductionCallback
* @return ProductionCallback
*/
@Override
public List<ProductionCallback> selectProductionCallbackList(ProductionCallback productionCallback)
{
return productionCallbackMapper.selectProductionCallbackList(productionCallback);
}
/**
* 批量删除ProductionCallback
*
* @param trayCodes 需要删除的ProductionCallback主键
* @return 结果
*/
@Override
public int deleteProductionCallbackByTrayCodes(String[] trayCodes)
{
return productionCallbackMapper.deleteProductionCallbackByTrayCodes(trayCodes);
}
/**
* 删除ProductionCallback信息
*
* @param trayCode ProductionCallback主键
* @return 结果
*/
@Override
public int deleteProductionCallbackByTrayCode(String trayCode)
{
return productionCallbackMapper.deleteProductionCallbackByTrayCode(trayCode);
}
@Override
public int updateProductionCallbackMsg(ProductionCallback productionCallback) {
return productionCallbackMapper.updateProductionCallbackMsg(productionCallback);
}
}

View File

@@ -19,7 +19,9 @@ import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.MessageUtils;
import com.ruoyi.in.erp.domain.ProductionCallback;
import com.ruoyi.in.erp.domain.TransferBillCallback;
import com.ruoyi.in.erp.service.IProductionCallbackService;
import com.ruoyi.in.erp.service.ITransferBillCallbackService;
import com.ruoyi.in.stockindetail.domain.InStockinDetail;
import com.ruoyi.in.stockindetail.service.IInStockinDetailService;
@@ -84,6 +86,8 @@ public class MydoJobServiceImpl implements IMydoJobService {
@Autowired
private ITransferBillCallbackService transferBillCallbackService;
@Autowired
private IProductionCallbackService productionCallbackService;
@Autowired
private BasStockMapper basStockMapper;
@Autowired
private BasProductMapper basProductMapper;
@@ -269,7 +273,6 @@ public class MydoJobServiceImpl implements IMydoJobService {
return AjaxResult.warn("任务不存在");
}
if ("5".equals(mydoJob.getInOrOut())){
//盘点入库
//入库作业
MydoJobDetail param = new MydoJobDetail();
@@ -302,15 +305,12 @@ public class MydoJobServiceImpl implements IMydoJobService {
//正常库存
list.add(stockByInStockinDetail);
}
}
//修改货位状态
basCargoSpace.setStatus("2");
basCargoSpace.setTrayCode(mydoJob.getTrayCode());
basCargoSpace.setCargoSpaceId(mydoJob.getCargoSpaceId());
basCargoSpaceService.updateBasCargoSpace(basCargoSpace);
//插入库存信息
basStockService.insertBasStockList(list);
@@ -320,6 +320,19 @@ public class MydoJobServiceImpl implements IMydoJobService {
updateMydoJob(mydoJob);
// 插入任务历史表 删除任务
insertHistory(mydoJob.getJobId());
TransferBillCallback transferBillCallback = new TransferBillCallback();
transferBillCallback.setJobId(mydoJob.getJobId());
transferBillCallback.setErpBill(mydoJob.getLineId());
transferBillCallback.setType("1");
transferBillCallback.setStatus("0");
BasProduct product = basProductMapper.selectBasProductByProductId(mydoJobDetails.get(0).getProductId());
transferBillCallback.setSpare1(mydoJobDetails.get(0).getProductId());
if(product != null) {
transferBillCallback.setSpare2(product.getProductName());
}
transferBillCallback.setSpare3(mydoJobDetails.get(0).getSpec());
transferBillCallback.setTrayCode(mydoJob.getTrayCode());
transferBillCallbackService.insertTransferBillCallback(transferBillCallback);
return AjaxResult.success();
} else {
return AjaxResult.warn("不存在子作业");
@@ -332,8 +345,12 @@ public class MydoJobServiceImpl implements IMydoJobService {
BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(mydoJob.getCargoSpaceId());
if (CollUtil.isNotEmpty(mydoJobDetails)) {
List<BasStock> list = new ArrayList<>();
BasProduct basProduct = basProductMapper.selectBasProductByProductId(mydoJobDetails.get(0).getProductId());
for (MydoJobDetail mydoJobDetail : mydoJobDetails) {
//正常库存
if(basProduct != null) {
mydoJobDetail.setProductName(basProduct.getProductName());
}
BasStock stockByInStockinDetail = getStockByInStockinDetail(mydoJobDetail, mydoJob, "1");
stockByInStockinDetail.setSpare7("0");
list.add(stockByInStockinDetail);
@@ -354,6 +371,22 @@ public class MydoJobServiceImpl implements IMydoJobService {
updateMydoJob(mydoJob);
// 插入任务历史表 删除任务
insertHistory(mydoJob.getJobId());
//报工数据插入
if("G1005".equals(mydoJob.getEntranceId())){
ProductionCallback productionCallback = new ProductionCallback();
productionCallback.setTrayCode(mydoJob.getTrayCode());
productionCallback.setBillNo(mydoJob.getLineId());
productionCallback.setProductId(mydoJobDetails.get(0).getProductId());
if(basProduct != null) {
productionCallback.setProductName(basProduct.getProductName());
}
productionCallback.setSpec(mydoJobDetails.get(0).getSpec());
productionCallback.setUnit(basProduct.getUnit());
productionCallback.setStatus("0");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
productionCallback.setCreateTime(sdf.format(new Date()));
productionCallbackService.insertProductionCallback(productionCallback);
}
//其他出入库单据回传
TransferBillCallback transferBillCallback = new TransferBillCallback();

View File

@@ -0,0 +1,106 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.in.erp.mapper.ProductionCallbackMapper">
<resultMap type="ProductionCallback" id="ProductionCallbackResult">
<result property="trayCode" column="tray_code" />
<result property="billNo" column="bill_no" />
<result property="productId" column="product_id" />
<result property="productName" column="product_name" />
<result property="spec" column="spec" />
<result property="unit" column="unit" />
<result property="status" column="status" />
<result property="createTime" column="create_time" />
<result property="returnCode" column="return_code" />
<result property="returnMsg" column="return_msg" />
</resultMap>
<sql id="selectProductionCallbackVo">
select tray_code, bill_no, product_id, product_name, spec, unit, status, create_time, return_code, return_msg from production_callback
</sql>
<select id="selectProductionCallbackList" parameterType="ProductionCallback" resultMap="ProductionCallbackResult">
<include refid="selectProductionCallbackVo"/>
<where>
<if test="billNo != null and billNo != ''"> and bill_no like concat('%', #{billNo}, '%')</if>
<if test="productId != null and productId != ''"> and product_id like concat('%', #{productId}, '%')</if>
<if test="productName != null and productName != ''"> and product_name like concat('%', #{productName}, '%')</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="returnCode != null and returnCode != ''"> and return_code = #{returnCode}</if>
</where>
</select>
<select id="selectProductionCallbackByTrayCode" parameterType="String" resultMap="ProductionCallbackResult">
<include refid="selectProductionCallbackVo"/>
where tray_code = #{trayCode}
</select>
<update id="updateProductionCallbackMsg" parameterType="ProductionCallback">
update production_callback
<trim prefix="SET" suffixOverrides=",">
<if test="billNo != null">bill_no = #{billNo},</if>
<if test="productId != null">product_id = #{productId},</if>
<if test="productName != null">product_name = #{productName},</if>
<if test="spec != null">spec = #{spec},</if>
<if test="unit != null">unit = #{unit},</if>
<if test="status != null">status = #{status},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="returnCode != null">return_code = #{returnCode},</if>
<if test="returnMsg != null">return_msg = #{returnMsg},</if>
</trim>
where tray_code = #{trayCode}
</update>
<delete id="deleteProductionCallbackByTrayCode" parameterType="String">
delete from production_callback where tray_code = #{trayCode}
</delete>
<delete id="deleteProductionCallbackByTrayCodes" parameterType="String">
delete from production_callback where tray_code in
<foreach item="trayCode" collection="array" open="(" separator="," close=")">
#{trayCode}
</foreach>
</delete>
<select id="getTopMsg" parameterType="String" resultMap="ProductionCallbackResult">
select top(1) tray_code,bill_no,product_id,product_name,spec,unit,status,create_time,return_code,return_msg
from production_callback
where status=#{status}
order by create_time asc
</select>
<update id="updateProductionCallback" parameterType="ProductionCallback">
update production_callback set status=#{status},return_code=#{returnCode},return_msg=#{returnMsg}
where tray_code = #{trayCode} and bill_no = #{billNo}
</update>
<insert id="insertProductionCallback" parameterType="ProductionCallback">
insert into production_callback
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="trayCode != null and trayCode != ''">tray_code,</if>
<if test="billNo != null and billNo != ''">bill_no,</if>
<if test="productId != null and productId != ''">product_id,</if>
<if test="productName != null and productName != ''">product_name,</if>
<if test="spec != null and spec != ''">spec,</if>
<if test="unit != null and unit != ''">unit,</if>
<if test="status != null and status != ''">status,</if>
<if test="createTime != null and createTime != ''">create_time,</if>
<if test="returnCode != null and returnCode != ''">return_code,</if>
<if test="returnMsg != null and returnMsg != ''">return_msg,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="trayCode != null and trayCode != ''">#{trayCode},</if>
<if test="billNo != null and billNo != ''">#{billNo},</if>
<if test="productId != null and productId != ''">#{productId},</if>
<if test="productName != null and productName != ''">#{productName},</if>
<if test="spec != null and spec != ''">#{spec},</if>
<if test="unit != null and unit != ''">#{unit},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="createTime != null and createTime != ''">#{createTime},</if>
<if test="returnCode != null and returnCode != ''">#{returnCode},</if>
<if test="returnMsg != null and returnMsg != ''">#{returnMsg},</if>
</trim>
</insert>
</mapper>

View File

@@ -27,11 +27,11 @@
<include refid="selectTransferBillCallbackVo"/>
<where>
<if test="jobId != null and jobId != ''"> and job_id = #{jobId}</if>
<if test="erpBill != null and erpBill != ''"> and erp_bill = #{erpBill}</if>
<if test="erpBill != null and erpBill != ''"> and erp_bill like concat('%',#{erpBill},'%')</if>
<if test="type != null and type != ''"> and type = #{type}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="finishTime != null and finishTime != ''"> and finish_time = #{finishTime}</if>
<if test="spare1 != null and spare1 != ''"> and spare1 = #{spare1}</if>
<if test="spare1 != null and spare1 != ''"> and spare1 like concat('%',#{spare1},'%')</if>
<if test="spare2 != null and spare2 != ''"> and spare2 = #{spare2}</if>
<if test="spare3 != null and spare3 != ''"> and spare3 = #{spare3}</if>
</where>