1. 更新入库接口,在入库任务生成后,接着调用ebs同步入库数量

This commit is contained in:
15066119699 2025-02-25 09:28:38 +08:00
parent 393a1ba534
commit c55d46329c
8 changed files with 230 additions and 144 deletions

View File

@ -41,7 +41,7 @@ import java.util.Objects;
/** /**
* 入库任务单Controller * 入库任务单Controller
* *
* @author tony.wu * @author tony.wu
* @date 2022-05-29 * @date 2022-05-29
*/ */
@ -221,6 +221,7 @@ public class TOngoodsshelfController extends BaseController
logger.error("提交入库的数据为空"); logger.error("提交入库的数据为空");
return error(); return error();
} }
TOngoodsshelf tOngoodsshelf = tOngoodsshelves.get(0);
// 查询当前入库的供应商 // 查询当前入库的供应商
TBaseProvider currentInProvider = tBaseProviderService.getOne(new LambdaQueryWrapper<TBaseProvider>() TBaseProvider currentInProvider = tBaseProviderService.getOne(new LambdaQueryWrapper<TBaseProvider>()
.eq(TBaseProvider::getRemark, "1") .eq(TBaseProvider::getRemark, "1")
@ -248,41 +249,37 @@ public class TOngoodsshelfController extends BaseController
Date date = new Date(); Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
SysUser sysUser = new SysUser(); SysUser sysUser = new SysUser();
if (StringUtils.isEmpty(tOngoodsshelves.get(0).getUserName())) { if (StringUtils.isEmpty(tOngoodsshelf.getUserName())) {
// 获取用户名 // 获取用户名
sysUser = ShiroUtils.getCurrentUser(); sysUser = ShiroUtils.getCurrentUser();
} else { } else {
sysUser.setUserName(tOngoodsshelves.get(0).getUserName()); sysUser.setUserName(tOngoodsshelf.getUserName());
} }
boolean providerValidation = true;
for (TOngoodsshelf s: if (!Objects.equals(tOngoodsshelf.getProviderId(), currentInProvider.getProviderId())) {
tOngoodsshelves) {
if (!Objects.equals(s.getProviderId(), currentInProvider.getProviderId())) {
providerValidation = false;
break;
}
s.setAgvsts("0");
s.setTasktype("0");
s.setLotId(lotId);
s.setOrderId(initOrderId());
s.setCreateDate(sdf.format(date));
s.setInstatus("0");
s.setUserName(sysUser.getUserName());
// 设置子库ID
s.setWhseloc("121-108");
}
if (!providerValidation) {
logger.error("不在入库状态的供应商不允许入库。"); logger.error("不在入库状态的供应商不允许入库。");
return error("不在入库状态的供应商不允许入库。"); return error("不在入库状态的供应商不允许入库。");
} }
// 开始对接ebs tOngoodsshelf.setAgvsts("0");
String ebsCongfirmResult = ebsConfirm(tOngoodsshelves); tOngoodsshelf.setTasktype("0");
tOngoodsshelf.setLotId(lotId);
tOngoodsshelf.setOrderId(initOrderId());
tOngoodsshelf.setCreateDate(sdf.format(date));
tOngoodsshelf.setInstatus("0");
tOngoodsshelf.setUserName(sysUser.getUserName());
// 设置子库ID
tOngoodsshelf.setWhseloc("121-108");
// 查询 缓存ebs订单
String ebsCongfirmResult = ebsConfirm(tOngoodsshelf);
if (StringUtils.isNotEmpty(ebsCongfirmResult)) { if (StringUtils.isNotEmpty(ebsCongfirmResult)) {
return error(ebsCongfirmResult); return error(ebsCongfirmResult);
} }
if (tOngoodsshelfService.insertTOngoodsshelfValues(tOngoodsshelves) < 1) { if (tOngoodsshelfService.insertTOngoodsshelf(tOngoodsshelf) < 1) {
return error("生成入库任务失败"); return error("生成入库任务失败");
} }
// 写入ebs
writeToEbs(tOngoodsshelf);
return success("生成入库任务成功"); return success("生成入库任务成功");
} }
@ -294,15 +291,22 @@ public class TOngoodsshelfController extends BaseController
@ResponseBody @ResponseBody
public AjaxResult wmsRcvProc(@RequestBody List<TOngoodsshelf> tOngoodsshelves) throws Exception { public AjaxResult wmsRcvProc(@RequestBody List<TOngoodsshelf> tOngoodsshelves) throws Exception {
logger.info("接收写入参数:{}", tOngoodsshelves.toString()); logger.info("接收写入参数:{}", tOngoodsshelves.toString());
writeToEbs(tOngoodsshelves.get(0));
return success("写入EBS成功");
}
private void writeToEbs(TOngoodsshelf tOngoodsshelve) throws Exception{
// 查询任务 // 查询任务
TOngoodsshelf queryOnTask = new TOngoodsshelf(); // TOngoodsshelf queryOnTask = new TOngoodsshelf();
queryOnTask.setInstand(tOngoodsshelves.get(0).getInstand()); // queryOnTask.setInstand(tOngoodsshelve.getInstand());
queryOnTask.setInstatus(tOngoodsshelves.get(0).getInstatus()); // queryOnTask.setInstatus(tOngoodsshelve.getInstatus());
List<TOngoodsshelf> tOngoodsshelvesNew = tOngoodsshelfService.selectTOngoodsshelfList(queryOnTask); // List<TOngoodsshelf> tOngoodsshelvesNew = tOngoodsshelfService.selectTOngoodsshelfList(queryOnTask);
// 获取token // 获取token
JSONObject token = JSON.parseObject(HttpUtils.httpPostJson(configService.selectConfigByKey("token_ip"), "", "")); JSONObject token = JSON.parseObject(HttpUtils.httpPostJson(configService.selectConfigByKey("token_ip"), "", ""));
for (TOngoodsshelf tOngoodsshelve : tOngoodsshelvesNew) { // for (TOngoodsshelf tOngoodsshelve : tOngoodsshelvesNew) {
// 获取本地缓存过的订单信息 // 获取本地缓存过的订单信息
//TODO 确定唯一一条数据
TEbsOrder queryOrder = new TEbsOrder(); TEbsOrder queryOrder = new TEbsOrder();
queryOrder.setPhaSegment1(tOngoodsshelve.getWmsorderid());// 订单号 queryOrder.setPhaSegment1(tOngoodsshelve.getWmsorderid());// 订单号
queryOrder.setItemId(Integer.parseInt(tOngoodsshelve.getGoodsTypeid())); queryOrder.setItemId(Integer.parseInt(tOngoodsshelve.getGoodsTypeid()));
@ -318,20 +322,20 @@ public class TOngoodsshelfController extends BaseController
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsRcvProc", 2, configService.selectConfigByKey("ebs_ip"), tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsRcvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsRcvProc, resultWmsRcvProc, "-1", "写入EBS", tOngoodsshelve.getGoodsid(), ebsOrder.getItemDescription(), tOngoodsshelve.getProduclotid(), tOngoodsshelve.getShelfNum())); paramsWmsRcvProc, resultWmsRcvProc, "-1", "写入EBS", tOngoodsshelve.getGoodsid(), ebsOrder.getItemDescription(), tOngoodsshelve.getProduclotid(), tOngoodsshelve.getShelfNum()));
// 接口失败 // 接口失败
return error("连接EBS失败"); throw new RuntimeException("连接EBS失败");
} }
System.out.println(resultWmsRcvProc); System.out.println(resultWmsRcvProc);
if (!JSON.parseObject(resultWmsRcvProc).getBoolean("success")) { if (!JSON.parseObject(resultWmsRcvProc).getBoolean("success")) {
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsRcvProc", 2, configService.selectConfigByKey("ebs_ip"), tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsRcvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsRcvProc, resultWmsRcvProc, "-1", "物料入库写入EBS", tOngoodsshelve.getGoodsid(), ebsOrder.getItemDescription(), tOngoodsshelve.getProduclotid(), tOngoodsshelve.getShelfNum())); paramsWmsRcvProc, resultWmsRcvProc, "-1", "物料入库写入EBS", tOngoodsshelve.getGoodsid(), ebsOrder.getItemDescription(), tOngoodsshelve.getProduclotid(), tOngoodsshelve.getShelfNum()));
return error("写入EBS失败:" + JSON.parseObject(resultWmsRcvProc).getString("msg")); throw new RuntimeException("写入EBS失败:" + JSON.parseObject(resultWmsRcvProc).getString("msg"));
} }
JSONObject resultJsonWmsRcvProc = (JSONObject) JSON.parseObject(resultWmsRcvProc).get("obj"); JSONObject resultJsonWmsRcvProc = (JSONObject) JSON.parseObject(resultWmsRcvProc).get("obj");
JSONObject dataWmsRcvProc = JSON.parseArray(resultJsonWmsRcvProc.getString("rows"), JSONObject.class).get(0); JSONObject dataWmsRcvProc = JSON.parseArray(resultJsonWmsRcvProc.getString("rows"), JSONObject.class).get(0);
if (!dataWmsRcvProc.getString("processStatus").equals("SUCCESS")) { if (!dataWmsRcvProc.getString("processStatus").equals("SUCCESS")) {
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsRcvProc", 2, configService.selectConfigByKey("ebs_ip"), tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsRcvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsRcvProc, resultWmsRcvProc, "-1", "物料入库写入EBS", tOngoodsshelve.getGoodsid(), ebsOrder.getItemDescription(), tOngoodsshelve.getProduclotid(), tOngoodsshelve.getShelfNum())); paramsWmsRcvProc, resultWmsRcvProc, "-1", "物料入库写入EBS", tOngoodsshelve.getGoodsid(), ebsOrder.getItemDescription(), tOngoodsshelve.getProduclotid(), tOngoodsshelve.getShelfNum()));
return error("写入EBS失败"); throw new RuntimeException("写入EBS失败");
} }
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsRcvProc", 2, configService.selectConfigByKey("ebs_ip"), tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsRcvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsRcvProc, resultWmsRcvProc, "0", "物料入库写入EBS", tOngoodsshelve.getGoodsid(), ebsOrder.getItemDescription(), tOngoodsshelve.getProduclotid(), tOngoodsshelve.getShelfNum())); paramsWmsRcvProc, resultWmsRcvProc, "0", "物料入库写入EBS", tOngoodsshelve.getGoodsid(), ebsOrder.getItemDescription(), tOngoodsshelve.getProduclotid(), tOngoodsshelve.getShelfNum()));
@ -341,113 +345,112 @@ public class TOngoodsshelfController extends BaseController
tOngoodsshelve.setAccStatus("5"); tOngoodsshelve.setAccStatus("5");
// 更新信息 // 更新信息
tOngoodsshelfService.updateTOngoodsshelf(tOngoodsshelve); tOngoodsshelfService.updateTOngoodsshelf(tOngoodsshelve);
} // }
return success("写入EBS成功");
} }
/** /**
* 对接ebs * 对接ebs
* *
* @param tOngoodsshelves * @param tOngoodsshelve
* @return * @return
* @throws Exception * @throws Exception
*/ */
public String ebsConfirm(List<TOngoodsshelf> tOngoodsshelves) { public String ebsConfirm(TOngoodsshelf tOngoodsshelve) {
try { try {
// 获取token // 获取token
JSONObject token = JSON.parseObject(HttpUtils.httpPostJson(configService.selectConfigByKey("token_ip"), "", "")); JSONObject token = JSON.parseObject(HttpUtils.httpPostJson(configService.selectConfigByKey("token_ip"), "", ""));
// 查询物料ID // 查询物料ID
for (TOngoodsshelf tOngoodsshelve : tOngoodsshelves) { // 物料id
// 物料id int itemId;
int itemId; // 先查询物料表根据当前的物料编码
// 先查询物料表根据当前的物料编码 TBaseGoods goodsTemp = goodsService.selectTBaseGoodsByGoodsId(tOngoodsshelve.getGoodsid());
TBaseGoods goodsTemp = goodsService.selectTBaseGoodsByGoodsId(tOngoodsshelve.getGoodsid()); if (goodsTemp != null) {
if (goodsTemp != null) { itemId = Integer.parseInt(goodsTemp.getGoodsTypeId());
itemId = Integer.parseInt(goodsTemp.getGoodsTypeId()); } else {
} else { JSONObject dataGetInvItemId = getInvItemId(tOngoodsshelve.getGoodsid(), token.get("access_token").toString());
JSONObject dataGetInvItemId = getInvItemId(tOngoodsshelve.getGoodsid(), token.get("access_token").toString()); logger.info("查询到的物料ID结果{}", JSON.toJSONString(dataGetInvItemId));
logger.info("查询到的物料ID结果{}", JSON.toJSONString(dataGetInvItemId)); itemId = dataGetInvItemId.getIntValue("inventoryItemId");
itemId = dataGetInvItemId.getIntValue("inventoryItemId"); // 将查到的信息存放到Goods表
// 将查到的信息存放到Goods表 TBaseGoods newGoods = new TBaseGoods();
TBaseGoods newGoods = new TBaseGoods(); // 物料ID
// 物料ID newGoods.setGoodsTypeId(String.valueOf(dataGetInvItemId.getIntValue("inventoryItemId")));
newGoods.setGoodsTypeId(String.valueOf(dataGetInvItemId.getIntValue("inventoryItemId"))); // 物料编码
// 物料编码 newGoods.setGoodsId(dataGetInvItemId.getString("itemCode"));
newGoods.setGoodsId(dataGetInvItemId.getString("itemCode")); // 物料描述
// 物料描述 newGoods.setGoodsName(dataGetInvItemId.getString("itemDesc"));
newGoods.setGoodsName(dataGetInvItemId.getString("itemDesc")); // 单位
// 单位 newGoods.setUnit(dataGetInvItemId.getString("primaryUnitOfMeasure"));
newGoods.setUnit(dataGetInvItemId.getString("primaryUnitOfMeasure")); goodsService.insertTBaseGoods(newGoods);
goodsService.insertTBaseGoods(newGoods); }
} // 订单号
// 订单号 String poOrder = tOngoodsshelve.getWmsorderid();
String poOrder = tOngoodsshelve.getWmsorderid(); // 根据物料Id和订单号获取EBS内订单
// 根据物料Id和订单号获取EBS内订单 List<TEbsOrder> targetOrders;
List<TEbsOrder> targetOrders; // 先查询本地数据库中是否已经缓存过
// 先查询本地数据库中是否已经缓存过 TEbsOrder queryOrder = new TEbsOrder();
TEbsOrder queryOrder = new TEbsOrder(); queryOrder.setPhaSegment1(poOrder);// 订单号
queryOrder.setPhaSegment1(poOrder);// 订单号 queryOrder.setItemId(itemId);
queryOrder.setItemId(itemId);
// queryOrder.setVendorId(tOngoodsshelve.getProviderId()); // queryOrder.setVendorId(tOngoodsshelve.getProviderId());
List<TEbsOrder> ebsOrders = itEbsOrderService.selectTEbsOrderList(queryOrder); List<TEbsOrder> ebsOrders = itEbsOrderService.selectTEbsOrderList(queryOrder);
logger.info("查询到的本地缓存订单:{}", JSON.toJSONString(ebsOrders)); logger.info("查询到的本地缓存订单:{}", JSON.toJSONString(ebsOrders));
if (ebsOrders.size() > 0) {// 本地数据库中缓存过 if (ebsOrders.size() > 0) {// 本地数据库中缓存过
targetOrders = ebsOrders; targetOrders = ebsOrders;
} else { } else {
targetOrders = getLinesAll(itemId, poOrder, token.get("access_token").toString()); targetOrders = getLinesAll(itemId, poOrder, token.get("access_token").toString());
logger.info("通过ebs查询到的订单信息{}", JSON.toJSONString(targetOrders)); logger.info("通过ebs查询到的订单信息{}", JSON.toJSONString(targetOrders));
if (targetOrders == null) { if (targetOrders == null) {
return "当前入库物料在EBS中没有对应订单"; return "当前入库物料在EBS中没有对应订单";
}
// 插入ebsOrder表
for (TEbsOrder targetOrder : targetOrders) {
targetOrder.setCreateDate(new Date());
itEbsOrderService.insertTEbsOrder(targetOrder);
}
} }
// 当前任务的入库数量 // 插入ebsOrder表
double tempInQuantity = tOngoodsshelve.getShelfNum().doubleValue();
for (TEbsOrder targetOrder : targetOrders) { for (TEbsOrder targetOrder : targetOrders) {
// 获取数量 targetOrder.setCreateDate(new Date());
double msQuantity = targetOrder.getMsQuantity(); targetOrder.setCreateTime(new Date());
if (msQuantity >= tempInQuantity) { targetOrder.setUpdateTime(new Date());
// 更新本地的可接收数量 itEbsOrderService.insertTEbsOrder(targetOrder);
targetOrder.setMsQuantity(msQuantity - tempInQuantity);
// 物料描述
tOngoodsshelve.setGoodsname(targetOrder.getItemDescription());
// 单位
tOngoodsshelve.setGoodsMeasureId(targetOrder.getUnitMeasLookupCode());
// itemID
tOngoodsshelve.setGoodsTypeid(targetOrder.getItemId().toString());
// 供应商名称
tOngoodsshelve.setCustomerId(targetOrder.getVendorName());
// 更新剩余入库数量
tempInQuantity = 0;
break;
} else {
// 更新本地的可接收数量
targetOrder.setMsQuantity(0.0);
// 物料描述
tOngoodsshelve.setGoodsname(targetOrder.getItemDescription());
// 单位
tOngoodsshelve.setGoodsMeasureId(targetOrder.getUnitMeasLookupCode());
// itemID
tOngoodsshelve.setGoodsTypeid(targetOrder.getItemId().toString());
// 供应商名称
tOngoodsshelve.setCustomerId(targetOrder.getVendorName());
// 更新剩余入库数量
tempInQuantity -= msQuantity;
}
} }
if (tempInQuantity > 0) { }
// 报错信息入库数量超过EBS内订单数量这条订单无法同步EBS // 当前任务的入库数量
return "入库数量超过EBS内订单可接收数量。</br>这条订单无法同步EBS。"; double tempInQuantity = tOngoodsshelve.getShelfNum().doubleValue();
for (TEbsOrder targetOrder : targetOrders) {
// 获取数量
double msQuantity = targetOrder.getMsQuantity();
if (msQuantity >= tempInQuantity) {
// 更新本地的可接收数量
targetOrder.setMsQuantity(msQuantity - tempInQuantity);
// 物料描述
tOngoodsshelve.setGoodsname(targetOrder.getItemDescription());
// 单位
tOngoodsshelve.setGoodsMeasureId(targetOrder.getUnitMeasLookupCode());
// itemID
tOngoodsshelve.setGoodsTypeid(targetOrder.getItemId().toString());
// 供应商名称
tOngoodsshelve.setCustomerId(targetOrder.getVendorName());
// 更新剩余入库数量
tempInQuantity = 0;
break;
} else { } else {
for (TEbsOrder targetOrder : targetOrders) { // 更新本地的可接收数量
// 更新EBS缓存的订单信息 targetOrder.setMsQuantity(0.0);
itEbsOrderService.updateTEbsOrder(targetOrder); // 物料描述
} tOngoodsshelve.setGoodsname(targetOrder.getItemDescription());
// 单位
tOngoodsshelve.setGoodsMeasureId(targetOrder.getUnitMeasLookupCode());
// itemID
tOngoodsshelve.setGoodsTypeid(targetOrder.getItemId().toString());
// 供应商名称
tOngoodsshelve.setCustomerId(targetOrder.getVendorName());
// 更新剩余入库数量
tempInQuantity -= msQuantity;
}
}
if (tempInQuantity > 0) {
// 报错信息入库数量超过EBS内订单数量这条订单无法同步EBS
return "入库数量超过EBS内订单可接收数量。</br>这条订单无法同步EBS。";
} else {
for (TEbsOrder targetOrder : targetOrders) {
// 更新EBS缓存的订单信息
//TODO 两条数据 怎么区分
itEbsOrderService.updateTEbsOrder(targetOrder);
} }
} }
} catch (Exception e) { } catch (Exception e) {

View File

@ -30,6 +30,8 @@
<result property="checkPriority" column="checkPriority" /> <result property="checkPriority" column="checkPriority" />
<result property="dueDate" column="dueDate" /> <result property="dueDate" column="dueDate" />
<result property="createDate" column="createDate" /> <result property="createDate" column="createDate" />
<result property="createTime" column="CREATE_TIME" />
<result property="updateTime" column="UPDATE_TIME" />
</resultMap> </resultMap>
<sql id="selectTEbsOrderALl"> <sql id="selectTEbsOrderALl">
@ -75,6 +77,7 @@
<if test="checkPriority != null">checkPriority,</if> <if test="checkPriority != null">checkPriority,</if>
<if test="dueDate != null">dueDate,</if> <if test="dueDate != null">dueDate,</if>
<if test="createDate != null">createDate,</if> <if test="createDate != null">createDate,</if>
<if test="createTime != null">CREATE_TIME,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="phaSegment1 != null">#{phaSegment1},</if> <if test="phaSegment1 != null">#{phaSegment1},</if>
@ -104,9 +107,41 @@
<if test="checkPriority != null">#{checkPriority},</if> <if test="checkPriority != null">#{checkPriority},</if>
<if test="dueDate != null">#{dueDate},</if> <if test="dueDate != null">#{dueDate},</if>
<if test="createDate != null">#{createDate},</if> <if test="createDate != null">#{createDate},</if>
<if test="createTime != null">#{createTime},</if>
</trim> </trim>
</insert> </insert>
<update id="updateById" parameterType="TEbsOrder">
update t_ebs_order
<trim prefix="SET" suffixOverrides=",">
<if test="shipmentNum != null">shipmentNum = #{shipmentNum},</if>
<if test="distributionNum != null">distributionNum = #{distributionNum},</if>
<if test="supplyTypeCode != null">supplyTypeCode = #{supplyTypeCode},</if>
<if test="msQuantity != null">msQuantity = #{msQuantity},</if>
<if test="poDistributionId != null">poDistributionId = #{poDistributionId},</if>
<if test="poHeaderId != null">poHeaderId = #{poHeaderId},</if>
<if test="poLineId != null">poLineId = #{poLineId},</if>
<if test="lineNum != null">lineNum = #{lineNum},</if>
<if test="orgId != null">orgId = #{orgId},</if>
<if test="shipToOrganizationId != null">shipToOrganizationId = #{shipToOrganizationId},</if>
<if test="itemDescription != null">itemDescription = #{itemDescription},</if>
<if test="unitMeasLookupCode != null">unitMeasLookupCode = #{unitMeasLookupCode},</if>
<if test="unitPrice != null">unitPrice = #{unitPrice},</if>
<if test="quantity != null">quantity = #{quantity},</if>
<if test="quantityReceived != null">quantityReceived = #{quantityReceived},</if>
<if test="closedCode != null">closedCode = #{closedCode},</if>
<if test="lineLocationId != null">lineLocationId = #{lineLocationId},</if>
<if test="vendorId != null">vendorId = #{vendorId},</if>
<if test="vendorName != null">vendorName = #{vendorName},</if>
<if test="wipEntityId != null">wipEntityId = #{wipEntityId},</if>
<if test="receivingRoutingId != null">receivingRoutingId = #{receivingRoutingId},</if>
<if test="lotControl != null">lotControl = #{lotControl},</if>
<if test="checkPriority != null">checkPriority = #{checkPriority},</if>
<if test="updateTime != null">UPDATE_TIME = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<update id="updateTEbsOrder" parameterType="TEbsOrder"> <update id="updateTEbsOrder" parameterType="TEbsOrder">
update t_ebs_order update t_ebs_order
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
@ -133,7 +168,7 @@
<if test="receivingRoutingId != null">receivingRoutingId = #{receivingRoutingId},</if> <if test="receivingRoutingId != null">receivingRoutingId = #{receivingRoutingId},</if>
<if test="lotControl != null">lotControl = #{lotControl},</if> <if test="lotControl != null">lotControl = #{lotControl},</if>
<if test="checkPriority != null">checkPriority = #{checkPriority},</if> <if test="checkPriority != null">checkPriority = #{checkPriority},</if>
<if test="createDate != null">createDate = #{createDate},</if> <if test="updateTime != null">UPDATE_TIME = #{updateTime},</if>
</trim> </trim>
where phaSegment1 = #{phaSegment1} and itemId = #{itemId} and dueDate = #{dueDate} where phaSegment1 = #{phaSegment1} and itemId = #{itemId} and dueDate = #{dueDate}
</update> </update>
@ -141,4 +176,4 @@
<delete id="deleteTEbsOrder" parameterType="TEbsOrder"> <delete id="deleteTEbsOrder" parameterType="TEbsOrder">
delete from t_ebs_order where phaSegment1 = #{phaSegment1} and itemId = #{itemId} and dueDate = #{dueDate} delete from t_ebs_order where phaSegment1 = #{phaSegment1} and itemId = #{itemId} and dueDate = #{dueDate}
</delete> </delete>
</mapper> </mapper>

View File

@ -18,15 +18,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="goodsName" column="goods_name" /> <result property="goodsName" column="goods_name" />
<result property="lotId" column="lot_id" /> <result property="lotId" column="lot_id" />
<result property="quantity" column="quantity" /> <result property="quantity" column="quantity" />
<result property="createTime" column="CREATE_TIME" />
<result property="updateTime" column="UPDATE_TIME" />
</resultMap> </resultMap>
<sql id="selectTEbsRecordVo"> <sql id="selectTEbsRecordVo">
select record_id, method_name, api_id, api_url, api_param, result, status, description, operate_time, goods_id, goods_name, lot_id, quantity from t_ebs_record select record_id, method_name, api_id, api_url, api_param, result, status, description, operate_time, goods_id, goods_name, lot_id, quantity,CREATE_TIME,UPDATE_TIME from t_ebs_record
</sql> </sql>
<select id="selectTEbsRecordList" parameterType="TEbsRecord" resultMap="TEbsRecordResult"> <select id="selectTEbsRecordList" parameterType="TEbsRecord" resultMap="TEbsRecordResult">
<include refid="selectTEbsRecordVo"/> <include refid="selectTEbsRecordVo"/>
<where> <where>
<if test="methodName != null and methodName != ''"> and method_name like concat('%', #{methodName}, '%')</if> <if test="methodName != null and methodName != ''"> and method_name like concat('%', #{methodName}, '%')</if>
<if test="apiId != null and apiId != 0"> and api_id = #{apiId}</if> <if test="apiId != null and apiId != 0"> and api_id = #{apiId}</if>
<if test="apiUrl != null and apiUrl != ''"> and api_url = #{apiUrl}</if> <if test="apiUrl != null and apiUrl != ''"> and api_url = #{apiUrl}</if>
@ -42,12 +44,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where> </where>
order by operate_time desc order by operate_time desc
</select> </select>
<select id="selectTEbsRecordByRecordId" parameterType="Long" resultMap="TEbsRecordResult"> <select id="selectTEbsRecordByRecordId" parameterType="Long" resultMap="TEbsRecordResult">
<include refid="selectTEbsRecordVo"/> <include refid="selectTEbsRecordVo"/>
where record_id = #{recordId} where record_id = #{recordId}
</select> </select>
<insert id="insertTEbsRecord" parameterType="TEbsRecord" useGeneratedKeys="true" keyProperty="recordId"> <insert id="insertTEbsRecord" parameterType="TEbsRecord" useGeneratedKeys="true" keyProperty="recordId">
insert into t_ebs_record insert into t_ebs_record
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
@ -62,6 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="goodsName != null">goods_name,</if> <if test="goodsName != null">goods_name,</if>
<if test="lotId != null">lot_id,</if> <if test="lotId != null">lot_id,</if>
<if test="quantity != null">quantity,</if> <if test="quantity != null">quantity,</if>
<if test="createTime != null">CREATE_TIME,</if>
operate_time, operate_time,
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
@ -76,6 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="goodsName != null">#{goodsName},</if> <if test="goodsName != null">#{goodsName},</if>
<if test="lotId != null">#{lotId},</if> <if test="lotId != null">#{lotId},</if>
<if test="quantity != null">#{quantity},</if> <if test="quantity != null">#{quantity},</if>
<if test="createTime != null">#{createTime},</if>
now() now()
</trim> </trim>
</insert> </insert>
@ -94,6 +98,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="goodsName != null">goods_name = #{goodsName},</if> <if test="goodsName != null">goods_name = #{goodsName},</if>
<if test="lotId != null">lot_id = #{lotId},</if> <if test="lotId != null">lot_id = #{lotId},</if>
<if test="quantity != null">quantity = #{quantity},</if> <if test="quantity != null">quantity = #{quantity},</if>
<if test="updateTime != null">UPDATE_TIME = #{updateTime},</if>
operate_time = now(), operate_time = now(),
</trim> </trim>
where record_id = #{recordId} where record_id = #{recordId}
@ -104,10 +109,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete> </delete>
<delete id="deleteTEbsRecordByRecordIds" parameterType="String"> <delete id="deleteTEbsRecordByRecordIds" parameterType="String">
delete from t_ebs_record where record_id in delete from t_ebs_record where record_id in
<foreach item="recordId" collection="array" open="(" separator="," close=")"> <foreach item="recordId" collection="array" open="(" separator="," close=")">
#{recordId} #{recordId}
</foreach> </foreach>
</delete> </delete>
</mapper> </mapper>

View File

@ -151,6 +151,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="towhseloc != null">TOWHSELOC,</if> <if test="towhseloc != null">TOWHSELOC,</if>
<if test="outstatus != null">OUTSTATUS,</if> <if test="outstatus != null">OUTSTATUS,</if>
<if test="userName != null">USERNAME,</if> <if test="userName != null">USERNAME,</if>
<if test="createTime != null">CREATE_TIME,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="pickingid != null and pickingid != ''">#{pickingid},</if> <if test="pickingid != null and pickingid != ''">#{pickingid},</if>
@ -191,6 +192,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="towhseloc != null">#{towhseloc},</if> <if test="towhseloc != null">#{towhseloc},</if>
<if test="outstatus != null">#{outstatus},</if> <if test="outstatus != null">#{outstatus},</if>
<if test="userName != null">#{userName},</if> <if test="userName != null">#{userName},</if>
<if test="createTime != null">#{createTime},</if>
</trim> </trim>
</insert> </insert>
@ -234,6 +236,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="towhseloc != null">TOWHSELOC = #{towhseloc},</if> <if test="towhseloc != null">TOWHSELOC = #{towhseloc},</if>
<if test="outstatus != null">OUTSTATUS = #{outstatus},</if> <if test="outstatus != null">OUTSTATUS = #{outstatus},</if>
<if test="userName != null">USERNAME = #{userName},</if> <if test="userName != null">USERNAME = #{userName},</if>
<if test="createTime != null">CREATE_TIME = #{createTime},</if>
</trim> </trim>
where PICKINGID = #{pickingid} where PICKINGID = #{pickingid}
</update> </update>

View File

@ -30,6 +30,8 @@
<result property="checkPriority" column="checkPriority" /> <result property="checkPriority" column="checkPriority" />
<result property="dueDate" column="dueDate" /> <result property="dueDate" column="dueDate" />
<result property="createDate" column="createDate" /> <result property="createDate" column="createDate" />
<result property="createTime" column="CREATE_TIME" />
<result property="updateTime" column="UPDATE_TIME" />
</resultMap> </resultMap>
<sql id="selectTEbsOrderALl"> <sql id="selectTEbsOrderALl">
@ -75,6 +77,7 @@
<if test="checkPriority != null">checkPriority,</if> <if test="checkPriority != null">checkPriority,</if>
<if test="dueDate != null">dueDate,</if> <if test="dueDate != null">dueDate,</if>
<if test="createDate != null">createDate,</if> <if test="createDate != null">createDate,</if>
<if test="createTime != null">CREATE_TIME,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="phaSegment1 != null">#{phaSegment1},</if> <if test="phaSegment1 != null">#{phaSegment1},</if>
@ -104,9 +107,41 @@
<if test="checkPriority != null">#{checkPriority},</if> <if test="checkPriority != null">#{checkPriority},</if>
<if test="dueDate != null">#{dueDate},</if> <if test="dueDate != null">#{dueDate},</if>
<if test="createDate != null">#{createDate},</if> <if test="createDate != null">#{createDate},</if>
<if test="createTime != null">#{createTime},</if>
</trim> </trim>
</insert> </insert>
<update id="updateById" parameterType="TEbsOrder">
update t_ebs_order
<trim prefix="SET" suffixOverrides=",">
<if test="shipmentNum != null">shipmentNum = #{shipmentNum},</if>
<if test="distributionNum != null">distributionNum = #{distributionNum},</if>
<if test="supplyTypeCode != null">supplyTypeCode = #{supplyTypeCode},</if>
<if test="msQuantity != null">msQuantity = #{msQuantity},</if>
<if test="poDistributionId != null">poDistributionId = #{poDistributionId},</if>
<if test="poHeaderId != null">poHeaderId = #{poHeaderId},</if>
<if test="poLineId != null">poLineId = #{poLineId},</if>
<if test="lineNum != null">lineNum = #{lineNum},</if>
<if test="orgId != null">orgId = #{orgId},</if>
<if test="shipToOrganizationId != null">shipToOrganizationId = #{shipToOrganizationId},</if>
<if test="itemDescription != null">itemDescription = #{itemDescription},</if>
<if test="unitMeasLookupCode != null">unitMeasLookupCode = #{unitMeasLookupCode},</if>
<if test="unitPrice != null">unitPrice = #{unitPrice},</if>
<if test="quantity != null">quantity = #{quantity},</if>
<if test="quantityReceived != null">quantityReceived = #{quantityReceived},</if>
<if test="closedCode != null">closedCode = #{closedCode},</if>
<if test="lineLocationId != null">lineLocationId = #{lineLocationId},</if>
<if test="vendorId != null">vendorId = #{vendorId},</if>
<if test="vendorName != null">vendorName = #{vendorName},</if>
<if test="wipEntityId != null">wipEntityId = #{wipEntityId},</if>
<if test="receivingRoutingId != null">receivingRoutingId = #{receivingRoutingId},</if>
<if test="lotControl != null">lotControl = #{lotControl},</if>
<if test="checkPriority != null">checkPriority = #{checkPriority},</if>
<if test="updateTime != null">UPDATE_TIME = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<update id="updateTEbsOrder" parameterType="TEbsOrder"> <update id="updateTEbsOrder" parameterType="TEbsOrder">
update t_ebs_order update t_ebs_order
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
@ -133,7 +168,7 @@
<if test="receivingRoutingId != null">receivingRoutingId = #{receivingRoutingId},</if> <if test="receivingRoutingId != null">receivingRoutingId = #{receivingRoutingId},</if>
<if test="lotControl != null">lotControl = #{lotControl},</if> <if test="lotControl != null">lotControl = #{lotControl},</if>
<if test="checkPriority != null">checkPriority = #{checkPriority},</if> <if test="checkPriority != null">checkPriority = #{checkPriority},</if>
<if test="createDate != null">createDate = #{createDate},</if> <if test="updateTime != null">UPDATE_TIME = #{updateTime},</if>
</trim> </trim>
where phaSegment1 = #{phaSegment1} and itemId = #{itemId} and dueDate = #{dueDate} where phaSegment1 = #{phaSegment1} and itemId = #{itemId} and dueDate = #{dueDate}
</update> </update>
@ -141,4 +176,4 @@
<delete id="deleteTEbsOrder" parameterType="TEbsOrder"> <delete id="deleteTEbsOrder" parameterType="TEbsOrder">
delete from t_ebs_order where phaSegment1 = #{phaSegment1} and itemId = #{itemId} and dueDate = #{dueDate} delete from t_ebs_order where phaSegment1 = #{phaSegment1} and itemId = #{itemId} and dueDate = #{dueDate}
</delete> </delete>
</mapper> </mapper>

View File

@ -18,15 +18,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="goodsName" column="goods_name" /> <result property="goodsName" column="goods_name" />
<result property="lotId" column="lot_id" /> <result property="lotId" column="lot_id" />
<result property="quantity" column="quantity" /> <result property="quantity" column="quantity" />
<result property="createTime" column="CREATE_TIME" />
<result property="updateTime" column="UPDATE_TIME" />
</resultMap> </resultMap>
<sql id="selectTEbsRecordVo"> <sql id="selectTEbsRecordVo">
select record_id, method_name, api_id, api_url, api_param, result, status, description, operate_time, goods_id, goods_name, lot_id, quantity from t_ebs_record select record_id, method_name, api_id, api_url, api_param, result, status, description, operate_time, goods_id, goods_name, lot_id, quantity,CREATE_TIME,UPDATE_TIME from t_ebs_record
</sql> </sql>
<select id="selectTEbsRecordList" parameterType="TEbsRecord" resultMap="TEbsRecordResult"> <select id="selectTEbsRecordList" parameterType="TEbsRecord" resultMap="TEbsRecordResult">
<include refid="selectTEbsRecordVo"/> <include refid="selectTEbsRecordVo"/>
<where> <where>
<if test="methodName != null and methodName != ''"> and method_name like concat('%', #{methodName}, '%')</if> <if test="methodName != null and methodName != ''"> and method_name like concat('%', #{methodName}, '%')</if>
<if test="apiId != null and apiId != 0"> and api_id = #{apiId}</if> <if test="apiId != null and apiId != 0"> and api_id = #{apiId}</if>
<if test="apiUrl != null and apiUrl != ''"> and api_url = #{apiUrl}</if> <if test="apiUrl != null and apiUrl != ''"> and api_url = #{apiUrl}</if>
@ -42,12 +44,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where> </where>
order by operate_time desc order by operate_time desc
</select> </select>
<select id="selectTEbsRecordByRecordId" parameterType="Long" resultMap="TEbsRecordResult"> <select id="selectTEbsRecordByRecordId" parameterType="Long" resultMap="TEbsRecordResult">
<include refid="selectTEbsRecordVo"/> <include refid="selectTEbsRecordVo"/>
where record_id = #{recordId} where record_id = #{recordId}
</select> </select>
<insert id="insertTEbsRecord" parameterType="TEbsRecord" useGeneratedKeys="true" keyProperty="recordId"> <insert id="insertTEbsRecord" parameterType="TEbsRecord" useGeneratedKeys="true" keyProperty="recordId">
insert into t_ebs_record insert into t_ebs_record
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
@ -62,6 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="goodsName != null">goods_name,</if> <if test="goodsName != null">goods_name,</if>
<if test="lotId != null">lot_id,</if> <if test="lotId != null">lot_id,</if>
<if test="quantity != null">quantity,</if> <if test="quantity != null">quantity,</if>
<if test="createTime != null">CREATE_TIME,</if>
operate_time, operate_time,
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
@ -76,6 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="goodsName != null">#{goodsName},</if> <if test="goodsName != null">#{goodsName},</if>
<if test="lotId != null">#{lotId},</if> <if test="lotId != null">#{lotId},</if>
<if test="quantity != null">#{quantity},</if> <if test="quantity != null">#{quantity},</if>
<if test="createTime != null">#{createTime},</if>
now() now()
</trim> </trim>
</insert> </insert>
@ -94,6 +98,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="goodsName != null">goods_name = #{goodsName},</if> <if test="goodsName != null">goods_name = #{goodsName},</if>
<if test="lotId != null">lot_id = #{lotId},</if> <if test="lotId != null">lot_id = #{lotId},</if>
<if test="quantity != null">quantity = #{quantity},</if> <if test="quantity != null">quantity = #{quantity},</if>
<if test="updateTime != null">UPDATE_TIME = #{updateTime},</if>
operate_time = now(), operate_time = now(),
</trim> </trim>
where record_id = #{recordId} where record_id = #{recordId}
@ -104,10 +109,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete> </delete>
<delete id="deleteTEbsRecordByRecordIds" parameterType="String"> <delete id="deleteTEbsRecordByRecordIds" parameterType="String">
delete from t_ebs_record where record_id in delete from t_ebs_record where record_id in
<foreach item="recordId" collection="array" open="(" separator="," close=")"> <foreach item="recordId" collection="array" open="(" separator="," close=")">
#{recordId} #{recordId}
</foreach> </foreach>
</delete> </delete>
</mapper> </mapper>

View File

@ -11,7 +11,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
/** /**
* Entity基类 * Entity基类
* *
* @author ruoyi * @author ruoyi
*/ */
public class BaseEntity implements Serializable public class BaseEntity implements Serializable
@ -27,7 +27,7 @@ public class BaseEntity implements Serializable
/** 创建时间 */ /** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField(value = "CREATE_DATE", fill = FieldFill.INSERT) @TableField(value = "CREATE_TIME", fill = FieldFill.INSERT)
private Date createTime; private Date createTime;
/** 更新者 */ /** 更新者 */
@ -36,7 +36,7 @@ public class BaseEntity implements Serializable
/** 更新时间 */ /** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField(value = "UPDATE_DATE", fill = FieldFill.INSERT_UPDATE) @TableField(value = "UPDATE_TIME", fill = FieldFill.INSERT_UPDATE)
private Date updateTime; private Date updateTime;
/** 备注 */ /** 备注 */

View File

@ -19,8 +19,8 @@ public class MybatisMetaObjectHandler implements MetaObjectHandler {
@Override @Override
public void insertFill(MetaObject metaObject) { public void insertFill(MetaObject metaObject) {
this.strictInsertFill(metaObject, "createDate", Date::new, Date.class); this.strictInsertFill(metaObject, "createTime", Date::new, Date.class);
this.strictInsertFill(metaObject, "updateDate", Date::new, Date.class); this.strictInsertFill(metaObject, "updateTime", Date::new, Date.class);
// this.strictInsertFill(metaObject, "delFlag", String.class,"0"); // this.strictInsertFill(metaObject, "delFlag", String.class,"0");
String loginName = ShiroUtils.getSysUser().getLoginName(); String loginName = ShiroUtils.getSysUser().getLoginName();
@ -31,7 +31,7 @@ public class MybatisMetaObjectHandler implements MetaObjectHandler {
@Override @Override
public void updateFill(MetaObject metaObject) { public void updateFill(MetaObject metaObject) {
this.strictInsertFill(metaObject, "updateDate", Date::new, Date.class); this.strictInsertFill(metaObject, "updateTime", Date::new, Date.class);
String loginName = ShiroUtils.getSysUser().getLoginName(); String loginName = ShiroUtils.getSysUser().getLoginName();
if (StringUtils.isEmpty(loginName)) return; if (StringUtils.isEmpty(loginName)) return;
this.strictInsertFill(metaObject, "updateBy", String.class, loginName); this.strictInsertFill(metaObject, "updateBy", String.class, loginName);