报工接口修改

master
philip 3 years ago
parent 4734e23238
commit 03a056f18d

@ -23,6 +23,32 @@ public class AccessoryLogController {
@Autowired
public AccessoryLogService accessoryLogService;
/**
*
*
* @return
*/
@ResponseBody
@GetMapping("/loadList")
public R getLoadList(AccessoryLog accessoryLog){
List<AccessoryLog> result;
result = accessoryLogService.getLoadLabelList(accessoryLog);
return R.ok(result);
}
/**
*
*
* @return
*/
@ResponseBody
@GetMapping("/loadConfirm")
public R loadInventory(AccessoryLog accessoryLog){
accessoryLogService.loadConfirm(accessoryLog);
return R.ok("上料成功");
}
/**
* id
*

@ -4,6 +4,8 @@ import com.foreverwin.mesnac.production.model.AccessoryLog;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* <p>
* 使 Mapper
@ -15,4 +17,5 @@ import org.springframework.stereotype.Repository;
@Repository
public interface AccessoryLogMapper extends BaseMapper<AccessoryLog> {
List<AccessoryLog> getLabelList(String site, String sfc, String stepId);
}

@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
@ -88,7 +89,7 @@ public class AccessoryLog extends Model<AccessoryLog> {
* 使
*/
@TableField("QTY")
private Double qty;
private BigDecimal qty;
/**
*
*/
@ -100,6 +101,16 @@ public class AccessoryLog extends Model<AccessoryLog> {
@TableField("CREATED_DATE_TIME")
private LocalDateTime createdDateTime;
@TableField(exist = false)
private String description;
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getHandle() {
return handle;
@ -197,11 +208,11 @@ public class AccessoryLog extends Model<AccessoryLog> {
this.revision = revision;
}
public Double getQty() {
public BigDecimal getQty() {
return qty;
}
public void setQty(Double qty) {
public void setQty(BigDecimal qty) {
this.qty = qty;
}

@ -25,4 +25,8 @@ public interface AccessoryLogService extends IService<AccessoryLog> {
IPage<AccessoryLog> selectPage(FrontPage<AccessoryLog> frontPage, AccessoryLog accessoryLog);
List<AccessoryLog> selectList(AccessoryLog accessoryLog);
void loadConfirm(AccessoryLog accessoryLog);
List<AccessoryLog> getLoadLabelList(AccessoryLog accessoryLog);
}

@ -1,17 +1,32 @@
package com.foreverwin.mesnac.production.service.impl;
import com.foreverwin.modular.core.util.FrontPage;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.foreverwin.mesnac.production.model.AccessoryLog;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.foreverwin.mesnac.common.enums.HandleEnum;
import com.foreverwin.mesnac.common.service.CommonService;
import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.mesnac.dispatch.model.ItemBatch;
import com.foreverwin.mesnac.dispatch.service.ItemBatchService;
import com.foreverwin.mesnac.meapi.model.Item;
import com.foreverwin.mesnac.meapi.model.Operation;
import com.foreverwin.mesnac.meapi.service.ItemService;
import com.foreverwin.mesnac.meapi.service.SfcService;
import com.foreverwin.mesnac.production.mapper.AccessoryLogMapper;
import com.foreverwin.mesnac.production.model.AccessoryLog;
import com.foreverwin.mesnac.production.service.AccessoryLogService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.foreverwin.modular.core.exception.BaseException;
import com.foreverwin.modular.core.util.CommonMethods;
import com.foreverwin.modular.core.util.FrontPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import java.util.UUID;
/**
* <p>
* 使
@ -27,7 +42,14 @@ public class AccessoryLogServiceImpl extends ServiceImpl<AccessoryLogMapper, Acc
@Autowired
private AccessoryLogMapper accessoryLogMapper;
@Autowired
private ItemBatchService itemBatchService;
@Autowired
private CommonService commonService;
@Autowired
private ItemService itemService;
@Autowired
private SfcService sfcService;
@Override
public IPage<AccessoryLog> selectPage(FrontPage<AccessoryLog> frontPage, AccessoryLog accessoryLog) {
QueryWrapper<AccessoryLog> queryWrapper = new QueryWrapper<>();
@ -42,5 +64,66 @@ public class AccessoryLogServiceImpl extends ServiceImpl<AccessoryLogMapper, Acc
return super.list(queryWrapper);
}
@Override
public void loadConfirm(AccessoryLog accessoryLog) {
String site = CommonMethods.getSite();
String resrce = accessoryLog.getResrce();
String sfc = accessoryLog.getSfc();
BigDecimal qty = accessoryLog.getQty();
String label = accessoryLog.getLabel();
QueryWrapper<ItemBatch> queryWrapper=new QueryWrapper<>();
queryWrapper.eq(ItemBatch.SITE,site);
queryWrapper.eq(ItemBatch.LABEL,label);
List<ItemBatch> list = itemBatchService.list(queryWrapper);
if (qty.compareTo(BigDecimal.ZERO)<=0){
throw new BaseException("数量不能小于零");
}
if (list.isEmpty()){
throw new BaseException("标签不存在");
}
ItemBatch itemBatch = list.get(0);
String workShopBo = commonService.getWorkShopBo(HandleEnum.RESOURCE.getHandle(site,resrce));
if (StringUtil.isBlank(workShopBo)) {
throw new BaseException("资源 " + resrce + " 未匹配到车间");
}
String sfcBO = HandleEnum.SFC.getHandle(site, sfc);
Operation operationBySfcBo = commonService.getOperationBySfcBo(sfcBO);
if (operationBySfcBo==null){
throw new BaseException("未找到产品条码信息");
}
accessoryLog.setHandle(UUID.randomUUID().toString());
accessoryLog.setSite(site);
accessoryLog.setWorkCenter(StringUtil.trimHandle(workShopBo));
accessoryLog.setShopOrder(StringUtil.trimHandle(sfcService.getById(sfcBO).getShopOrderBo()));
accessoryLog.setOperation(operationBySfcBo.getOperation());
accessoryLog.setStepId(operationBySfcBo.getStepId());
accessoryLog.setBatch(itemBatch.getBatch());
String item = itemBatch.getItem();
Item selectCurrent = itemService.selectCurrent(site, item);
if (selectCurrent==null){
throw new BaseException("标签物料不存在当前版本");
}
accessoryLog.setItem(item);
accessoryLog.setRevision(selectCurrent.getRevision());
accessoryLog.setCreateUser(CommonMethods.getUser());
accessoryLog.setCreatedDateTime(LocalDateTime.now());
save(accessoryLog);
}
@Override
public List<AccessoryLog> getLoadLabelList(AccessoryLog accessoryLog) {
String site = CommonMethods.getSite();
String sfc = accessoryLog.getSfc();
String sfcBO = HandleEnum.SFC.getHandle(site, sfc);
Operation operationBySfcBo = commonService.getOperationBySfcBo(sfcBO);
if (operationBySfcBo==null){
throw new BaseException("未找到产品条码信息");
}
if (operationBySfcBo==null){
throw new BaseException("未找到产品条码信息");
}
return accessoryLogMapper.getLabelList(site,sfc,operationBySfcBo.getStepId());
}
}

@ -363,7 +363,7 @@ public class PodTemplateServiceImpl implements PodTemplateService {
if (inventoryList.isEmpty()) {
throw new BaseException("设备没有上" + StringUtil.trimHandle(componentGbo) + "/" + currentReversionItem.getDescription() + "料");
}
BigDecimal needQty = new BigDecimal(BomComponentDto.getQty()).multiply(new BigDecimal(sfcServiceById.getQty()));
BigDecimal needQty = new BigDecimal(String.valueOf(BomComponentDto.getQty())).multiply(new BigDecimal(sfcServiceById.getQty()));
for (LoadInventory loadInventory : inventoryList) {
BigDecimal qtyOnHand = loadInventory.getQtyOnHand();
BigDecimal costQty;
@ -465,10 +465,10 @@ public class PodTemplateServiceImpl implements PodTemplateService {
ZprodordconfStruOut[] outs = new ZprodordconfStruOut[1];
ZprodordconfStruOut struOut = new ZprodordconfStruOut();
struOut.setAufnr("");
struOut.setVornr("");
struOut.setAufnr(ins[0].getAufnr());
struOut.setVornr(ins[0].getVornr());
struOut.setAueru("1");
struOut.setLmnga(BigDecimal.ZERO);
struOut.setLmnga(ins[0].getLmnga());
struOut.setRet("");
struOut.setMsg("");
outs[0] = struOut;
@ -477,12 +477,13 @@ public class PodTemplateServiceImpl implements PodTemplateService {
//调用WS
try {
ERPAPI.erpWebService().zmesProdordconf(inHolder, outHolder);
} catch (RemoteException e) {
String status = outHolder.value[1].getRet();
String message = outHolder.value[1].getMsg();
if (status.equals("E")) {
throw new BaseException("ERP接口返回状态:" + status + ",消息:" + message);
}
} catch (RemoteException e) {
ExceptionUtil.throwException(e);
} finally {
//记录接口日志
IntegrationLog log = new IntegrationLog();
@ -492,7 +493,7 @@ public class PodTemplateServiceImpl implements PodTemplateService {
log.setCategory("REQUEST");
log.setIntegrationWay("ERP");
log.setIntegrationMethod("erpWebService.zmesProdordconf");
log.setParam(ins.toString());
log.setParam(inHolder.toString());
log.setStatus(outHolder.value[1].getRet());
log.setResultMessage(outHolder.value[1].getMsg());
log.setTransactionId("");

@ -19,6 +19,8 @@
<result column="QTY" property="qty" />
<result column="CREATE_USER" property="createUser" />
<result column="CREATED_DATE_TIME" property="createdDateTime" />
<result column="DESCRIPTION" property="description" />
</resultMap>
<!-- 通用查询结果列 -->
@ -478,5 +480,9 @@
</foreach>)
</delete>
<!-- BaseMapper标准查询/修改/删除 -->
<select id="getLabelList" resultMap="BaseResultMap">
SELECT ZAL.*,IT.DESCRIPTION FROM Z_ACCESSORY_LOG zal
INNER JOIN ITEM IM ON IM.SITE = zal.SITE AND IM.ITEM=zal.ITEM
LEFT JOIN ITEM_T IT ON IT.ITEM_BO = IM.HANDLE AND IT.LOCALE = 'zh'
</select>
</mapper>

Loading…
Cancel
Save