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

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

View File

@ -30,6 +30,8 @@
<result property="checkPriority" column="checkPriority" />
<result property="dueDate" column="dueDate" />
<result property="createDate" column="createDate" />
<result property="createTime" column="CREATE_TIME" />
<result property="updateTime" column="UPDATE_TIME" />
</resultMap>
<sql id="selectTEbsOrderALl">
@ -75,6 +77,7 @@
<if test="checkPriority != null">checkPriority,</if>
<if test="dueDate != null">dueDate,</if>
<if test="createDate != null">createDate,</if>
<if test="createTime != null">CREATE_TIME,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="phaSegment1 != null">#{phaSegment1},</if>
@ -104,9 +107,41 @@
<if test="checkPriority != null">#{checkPriority},</if>
<if test="dueDate != null">#{dueDate},</if>
<if test="createDate != null">#{createDate},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</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 t_ebs_order
<trim prefix="SET" suffixOverrides=",">
@ -133,7 +168,7 @@
<if test="receivingRoutingId != null">receivingRoutingId = #{receivingRoutingId},</if>
<if test="lotControl != null">lotControl = #{lotControl},</if>
<if test="checkPriority != null">checkPriority = #{checkPriority},</if>
<if test="createDate != null">createDate = #{createDate},</if>
<if test="updateTime != null">UPDATE_TIME = #{updateTime},</if>
</trim>
where phaSegment1 = #{phaSegment1} and itemId = #{itemId} and dueDate = #{dueDate}
</update>

View File

@ -18,10 +18,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="goodsName" column="goods_name" />
<result property="lotId" column="lot_id" />
<result property="quantity" column="quantity" />
<result property="createTime" column="CREATE_TIME" />
<result property="updateTime" column="UPDATE_TIME" />
</resultMap>
<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>
<select id="selectTEbsRecordList" parameterType="TEbsRecord" resultMap="TEbsRecordResult">
@ -62,6 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="goodsName != null">goods_name,</if>
<if test="lotId != null">lot_id,</if>
<if test="quantity != null">quantity,</if>
<if test="createTime != null">CREATE_TIME,</if>
operate_time,
</trim>
<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="lotId != null">#{lotId},</if>
<if test="quantity != null">#{quantity},</if>
<if test="createTime != null">#{createTime},</if>
now()
</trim>
</insert>
@ -94,6 +98,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="goodsName != null">goods_name = #{goodsName},</if>
<if test="lotId != null">lot_id = #{lotId},</if>
<if test="quantity != null">quantity = #{quantity},</if>
<if test="updateTime != null">UPDATE_TIME = #{updateTime},</if>
operate_time = now(),
</trim>
where record_id = #{recordId}

View File

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

View File

@ -30,6 +30,8 @@
<result property="checkPriority" column="checkPriority" />
<result property="dueDate" column="dueDate" />
<result property="createDate" column="createDate" />
<result property="createTime" column="CREATE_TIME" />
<result property="updateTime" column="UPDATE_TIME" />
</resultMap>
<sql id="selectTEbsOrderALl">
@ -75,6 +77,7 @@
<if test="checkPriority != null">checkPriority,</if>
<if test="dueDate != null">dueDate,</if>
<if test="createDate != null">createDate,</if>
<if test="createTime != null">CREATE_TIME,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="phaSegment1 != null">#{phaSegment1},</if>
@ -104,9 +107,41 @@
<if test="checkPriority != null">#{checkPriority},</if>
<if test="dueDate != null">#{dueDate},</if>
<if test="createDate != null">#{createDate},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</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 t_ebs_order
<trim prefix="SET" suffixOverrides=",">
@ -133,7 +168,7 @@
<if test="receivingRoutingId != null">receivingRoutingId = #{receivingRoutingId},</if>
<if test="lotControl != null">lotControl = #{lotControl},</if>
<if test="checkPriority != null">checkPriority = #{checkPriority},</if>
<if test="createDate != null">createDate = #{createDate},</if>
<if test="updateTime != null">UPDATE_TIME = #{updateTime},</if>
</trim>
where phaSegment1 = #{phaSegment1} and itemId = #{itemId} and dueDate = #{dueDate}
</update>

View File

@ -18,10 +18,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="goodsName" column="goods_name" />
<result property="lotId" column="lot_id" />
<result property="quantity" column="quantity" />
<result property="createTime" column="CREATE_TIME" />
<result property="updateTime" column="UPDATE_TIME" />
</resultMap>
<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>
<select id="selectTEbsRecordList" parameterType="TEbsRecord" resultMap="TEbsRecordResult">
@ -62,6 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="goodsName != null">goods_name,</if>
<if test="lotId != null">lot_id,</if>
<if test="quantity != null">quantity,</if>
<if test="createTime != null">CREATE_TIME,</if>
operate_time,
</trim>
<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="lotId != null">#{lotId},</if>
<if test="quantity != null">#{quantity},</if>
<if test="createTime != null">#{createTime},</if>
now()
</trim>
</insert>
@ -94,6 +98,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="goodsName != null">goods_name = #{goodsName},</if>
<if test="lotId != null">lot_id = #{lotId},</if>
<if test="quantity != null">quantity = #{quantity},</if>
<if test="updateTime != null">UPDATE_TIME = #{updateTime},</if>
operate_time = now(),
</trim>
where record_id = #{recordId}

View File

@ -27,7 +27,7 @@ public class BaseEntity implements Serializable
/** 创建时间 */
@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;
/** 更新者 */
@ -36,7 +36,7 @@ public class BaseEntity implements Serializable
/** 更新时间 */
@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;
/** 备注 */

View File

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