手动同步物料接口

master
FCD 1 day ago
parent af40995f1e
commit a3e5cc9282

@ -164,6 +164,13 @@ public interface RemoteSapService {
@PostMapping("/sap/sapTransferPosting")
R sapTransferPosting(@RequestBody List<Map<String,Object>> list);
/**
*
* **/
@PostMapping("/sap/syncBaseProduct")
R syncBaseProduct(@RequestBody Map<String,Object> params);
}

@ -208,6 +208,16 @@ public class RemoteSapFallbackFactory implements FallbackFactory<RemoteSapServic
return R.fail("311转储过账" + throwable.getMessage());
}
/**
*
*
* @param params
**/
@Override
public R syncBaseProduct(Map<String, Object> params) {
return R.fail("手动同步物料失败" + throwable.getMessage());
}
};
}
}

@ -2,6 +2,7 @@ package com.op.wms.controller;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
@ -111,4 +112,18 @@ public class BaseProductController extends BaseController {
public AjaxResult remove(@PathVariable String[] productIds) {
return toAjax(baseProductService.deleteBaseProductByProductIds(productIds));
}
/**
*
*/
@Log(title = "手动同步物料", businessType = BusinessType.SAP)
@PostMapping("/sync")
public AjaxResult sync(@RequestBody Map<String,Object> params) {
baseProductService.syncBaseProduct(params);
return success();
}
}

@ -1,6 +1,7 @@
package com.op.wms.service;
import java.util.List;
import java.util.Map;
import com.op.wms.domain.BaseProduct;
@ -64,4 +65,6 @@ public interface IBaseProductService {
boolean checkNameUnique(BaseProduct baseProduct);
public BaseProduct selectBaseProductByProductCode(String productCode);
void syncBaseProduct( Map<String,Object> params);
}

@ -1,10 +1,13 @@
package com.op.wms.service.impl;
import java.util.List;
import java.util.Map;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.domain.R;
import com.op.common.core.utils.DateUtils;
import com.op.common.security.utils.SecurityUtils;
import com.op.system.api.RemoteSapService;
import com.op.wms.domain.BaseTeamT;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -23,6 +26,9 @@ public class BaseProductServiceImpl implements IBaseProductService {
@Autowired
private BaseProductMapper baseProductMapper;
@Autowired
private RemoteSapService remoteSapService;
/**
*
*
@ -138,4 +144,12 @@ public class BaseProductServiceImpl implements IBaseProductService {
public BaseProduct selectBaseProductByProductCode(String productCode) {
return baseProductMapper.selectBaseProductByProductCode(productCode);
}
@Override
public void syncBaseProduct( Map<String,Object> params) {
R result = remoteSapService.syncBaseProduct(params);
if (result.getCode() != 200){
throw new RuntimeException("同步失败:"+result.getMsg());
}
}
}

@ -2254,67 +2254,5 @@
</update>
<select id="getStockAreaEntryList" resultType="com.op.wms.domain.WmsStockAreaEntry" parameterType="com.op.wms.domain.WmsStockAreaEntry">
SELECT
CONVERT(VARCHAR, pow.product_date, 23) productionDate,
SUBSTRING(pow.workorder_code_sap, 4, 10) workOrderCode,
SUBSTRING(pow.product_code, 8,11) materialCode,
pow.product_name materialName,
CASE
WHEN LEN(powb.batch_code) = 24 THEN SUBSTRING(powb.batch_code, 13, 10)
WHEN LEN(powb.batch_code) <![CDATA[ < ]]> 24 THEN powb.batch_code
WHEN LEN(powb.batch_code) > 24 THEN CONVERT(VARCHAR(8), pow.create_time, 112)
ELSE ''
END batchCode
FROM pro_order_workorder pow
LEFT JOIN pro_order_workorder_batch powb ON pow.workorder_id = powb.workorder_id
WHERE powb.del_flag = '0' AND pow.product_code like '00000001%' and pow.parent_order = '0'
<if test="beginDate != null ">and CONVERT(varchar(10),pow.product_date, 120) >= '${beginDate}'</if>
<if test="endDate != null ">and '${endDate}' >= CONVERT(varchar(10),pow.product_date, 120)</if>
<if test="workOrderCode != null and workOrderCode != ''">and pow.workorder_code like concat('%', #{workOrderCode}, '%')</if>
<if test="status != null and status != ''">and pow.status = #{status}</if>
<if test="materialCode != null and materialCode != ''">and pow.product_code like concat('%', #{materialCode},'%')</if>
ORDER BY pow.workorder_code_sap, powb.batch_code
</select>
<select id="batchCheckDuplication" resultType="com.op.wms.domain.WmsStockAreaEntry" parameterType="list">
SELECT material_code materialCode, batch_code batchCode, factory_code factoryCode, area_code areaCode
FROM wms_material_entry
WHERE CONCAT(material_code, batch_code, factory_code, area_code) IN
<foreach collection="list" item="item" open="(" separator="," close=")">
CONCAT(#{item.materialCode}, #{item.batchCode}, #{item.factoryCode}, #{item.areaCode})
</foreach>
</select>
<insert id="batchInsertMaterialEntry" parameterType="list">
INSERT INTO wms_material_entry (
work_order_code,
material_code,
batch_code,
factory_code,
location,
area_code,
status,
create_time,
create_by
)
VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.workOrderCode},
#{item.materialCode},
#{item.batchCode},
#{item.factoryCode},
#{item.location},
#{item.areaCode},
#{item.status},
GETDATE(),
#{item.createBy}
)
</foreach>
</insert>
</mapper>

Loading…
Cancel
Save