Commit c9405e14 孙克

原材料入库时,设备端使用接口判断料串的物料是否可以放入指定的格口

1 个父辈 18ea9e1c
......@@ -103,6 +103,17 @@ public class DateUtil {
return c.getTime();
}
public static Date getNoTimeDate(String dateStr){
try{
Date date = toDate(dateStr,"yyyy-MM-dd HH:mm:ss");
Calendar c = noTimeCalendar();
c.setTime(date);
return c.getTime();
}catch (Exception e){
return null;
}
}
private static Calendar noTimeCalendar(){
Calendar c = Calendar.getInstance();
c.set(Calendar.HOUR, 0);
......
......@@ -170,6 +170,39 @@ public class Barcode extends BasePo implements Serializable {
// * 料盒条码:料盒内所有物料条码,key=barcode
// */
// private Map<String, Barcode> subCodeMap;
/**
* 额外的一些信息属性
*/
private Map<String,String> extraDataMap = new HashMap<>();
/**
* 获取Barcode的一些额外属性
*/
public String getExtraData(String key){
if(extraDataMap == null){
return null;
}
return extraDataMap.get(key);
}
/**
* 为Barcode添加一些额外的属性, 如果value为Null, 则表示删除该属性
* @param key
* @param value
*/
public void updateExtraData(String key, String value){
if(extraDataMap == null){
extraDataMap = new HashMap<>();
}
if(value == null){
extraDataMap.remove(key);
}else{
extraDataMap.put(key, value);
}
}
/**
* 料盒条码:料盒内所有物料条码
*/
......
......@@ -429,7 +429,7 @@ public class CodeResolve {
}
if(barcode == null){
throw new ValidateException("smfcore.error.barcode.invalid", "{0}不是有效的条码",new String[]{codeStr});
throw new ValidateException("smfcore.error.barcode.invalid", "未找到有效的条码",new String[]{codeStr});
}
return barcode;
}
......
......@@ -471,7 +471,7 @@ public class StoragePosController {
List<StoragePosDto> StoragePosDtos = storagePosMapper.toDto(pages.getContent());
for (StoragePosDto storagePosDto : StoragePosDtos) {
BarcodeDto barcode = storagePosDto.getBarcode();
if (barcode.getPutInTime() == -1){
if (barcode != null && barcode.getPutInTime() == -1){
barcode.setFirstPutInDate(barcode.getCreateDate());
//storagePosDto.setBarcode(barcode);
}
......
......@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.neotel.smfcore.common.bean.ReelLockPosInfo;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.DateUtil;
import com.neotel.smfcore.common.utils.ReelLockPosUtil;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.api.SmfApi;
......@@ -125,9 +126,11 @@ public class CDeviceController {
//判断条码是否正常
Barcode barcode = codeResolve.resolveOneValideBarcode(codeStr);
if (barcode == null) {
return ResultBean.newErrorResult(-1, "", "物料条码无效");
Barcode barcode = null;
try{
barcode = codeResolve.resolveOneValideBarcode(codeStr);
}catch (ValidateException ve){
return ResultBean.newErrorResult(-1, ve.getMsgKey(), ve.getDefaultMsg());
}
......@@ -174,40 +177,6 @@ public class CDeviceController {
}
if(boxBarcode != null){
List<Barcode> subCodeList = boxBarcode.getSubCodeList();
Barcode subCodeInBin = null;
if (subCodeList != null && !subCodeList.isEmpty()) {
//找到料箱中该料格的第一个条码
for (Barcode subCodeInBox : subCodeList) {
if(subCodeInBox.getPosName().equalsIgnoreCase(binCodeStr)){
subCodeInBin = subCodeInBox;
break;
}
}
if(subCodeInBin != null){
String partNumber = barcode.getPartNumber();
String provider = barcode.getProvider();
String warehouseCode = barcode.getWarehouseCode();
if (partNumber.equals(subCodeInBin.getPartNumber())
&& provider.equals(subCodeInBin.getProvider())
&& subCodeInBin.getWarehouseCode().equals(warehouseCode)) {
//判断GR信息是否相同
log.info(barcode.getBarcode()+"当前物料的来源是:"+soucre+",料格"+subCodeInBin.getBarcode()+"的来源是:"+subCodeInBin.getBarSource());
if (StringUtils.isNotEmpty(soucre)){
if (!soucre.equals(subCodeInBin.getBarSource())){
return ResultBean.newErrorResult(-1,"",binCodeStr+"的来源是:"+subCodeInBin.getBarSource()+"与当前入库的来源:"+soucre+"不一致");
}
}
} else {
return ResultBean.newErrorResult(-1, "",
"料号:" + partNumber + ",供应商:" + provider + ",库别:" + warehouseCode
+ "与料格中的料号:" + subCodeInBin.getPartNumber() + ",供应商:" + subCodeInBin.getProvider() + "库别:" + subCodeInBin.getWarehouseCode() + "不一致");
}
}
}
//判断隔口是否可以放入
if (BinCacheUtil.canPutInBinCode(binCodeStr, warhouseCode)) {
if (MaterialUtil.bindGr(materialStr)){
......@@ -218,6 +187,9 @@ public class CDeviceController {
barcode.getAmount(),
binCodeStr,Arrays.asList(barcode.getFullCode())
));
//将GR日期设置为生产日期
Date grDate = DateUtil.getNoTimeDate(bindGrInfo.getGrDate());
barcode.setProduceDate(grDate);
}
barcode.setPosName(binCodeStr);
barcode.setWarehouseCode(warhouseCode);
......@@ -238,19 +210,20 @@ public class CDeviceController {
}
@ApiOperation("物料放入料格完成")
@ApiOperation("料格已放满")
@RequestMapping("/finishPutInMaterialBin")
@AnonymousAccess
public ResultBean finishPutInMaterialBin(@RequestBody Map<String, String> paramMap) {
String binCode = paramMap.get("binCode");
String binCodeStr = paramMap.get("binCode");
String materialStr = paramMap.get("materialStr");
log.info("料箱或者料串已经放满,收到料格信息为" + binCode + ",料串信息为:" + materialStr);
log.info("料格已经放满,收到料格信息为" + binCodeStr + ",料串信息为:" + materialStr);
//Barcode barcode = codeResolve.resolveOneValideBarcode(binCode);
//if (barcode == null) {
// throw new ValidateException("smfcore.error.barcode.invalid", "{0}不是有效的条码", new String[]{binCode});
//}
String boxStr = BoxHandleUtil.getBoxStr(binCodeStr);
Barcode boxBarcode = codeResolve.resolveOneValideBarcode(boxStr);
//该料格有出库时, 需要清理此字段
boxBarcode.updateExtraData(binCodeStr,"FULL");
barcodeManager.saveBarcode(boxBarcode);
return ResultBean.newOkResult("");
}
......@@ -435,6 +408,8 @@ public class CDeviceController {
dataLog.setPosName(boxStr);
taskService.updateFinishedTask(dataLog);
//有出库,此料格就去除满格标志
boxBarcode.updateExtraData(subCode.getPosName(),null);
boxBarcode.removeFromSubCodes(subCode);
barcodeManager.save(boxBarcode);
if(inPos != null){
......@@ -538,9 +513,10 @@ public class CDeviceController {
return ResultBean.newErrorResult(-1,"","未找到"+boxStr+"的入库库位");
}
@ApiOperation("返回Barcode信息")
@ApiOperation("不再使用")
@RequestMapping("/getBarcode")
@AnonymousAccess
@Deprecated
public Barcode getBarcode(@RequestBody Map<String,String> paramMap){
String codeStr = paramMap.get("codeStr");
//解析条码为barcode
......@@ -551,6 +527,79 @@ public class CDeviceController {
return barcode;
}
@ApiOperation("入料机构获取可用料格")
@RequestMapping("/validBin")
@AnonymousAccess
public ResultBean validBin(@RequestBody Map<String,String> paramMap){
String stackerId = paramMap.get("stackerId");
String binListStr = paramMap.get("binList");
List<String> validBinList = new ArrayList<String>();
log.info("入料机构获取料串["+stackerId+"]的可用料格["+binListStr+"]");
BindGrInfo bindGrInfo = MaterialUtil.getBindGrInfo(stackerId);
if(bindGrInfo == null){
return ResultBean.newErrorResult(-1,"error.nobind","料串["+stackerId+"]未绑定GR");
}
Barcode stackerBarcode = new Barcode();
stackerBarcode.setBarcode(stackerId);
stackerBarcode.setPartNumber(bindGrInfo.getMaterialCode());
stackerBarcode.setProvider(bindGrInfo.getBrand());
//将GR日期设置为生产日期
Date grDate = DateUtil.getNoTimeDate(bindGrInfo.getGrDate());
stackerBarcode.setProduceDate(grDate);
String[] binList = binListStr.split(",");
for (String binId : binList) {
String boxStr = BoxHandleUtil.getBoxStr(binId);
Barcode boxBarcode = codeResolve.resolveOneValideBarcode(boxStr);
String canPutIn = canMaterialPutInBin(stackerBarcode,boxBarcode,binId);
if(canPutIn.isEmpty()){
validBinList.add(binId);
}
}
Map<String,Object> dataMap = new HashMap<>();
dataMap.put("validBinList",validBinList);
return ResultBean.newOkResult(dataMap);
}
/**
* 验证物料是否可以放入料格:
* 1 料格未满 2 料格中若有物料,必须料号,供应商,库别,过账日期一致才可放入
* @return
*/
public String canMaterialPutInBin(Barcode reelBarcode, Barcode boxBarcode, String binId){
String isBinFull = boxBarcode.getExtraData(binId);
if(isBinFull != null){
//该料格已放满, 不可以再放料
return "料格["+binId+"]已满,不可放入物料["+reelBarcode.getBarcode()+"]";
}
if (BinCacheUtil.canPutInBinCode(binId, reelBarcode.getWarehouseCode())) {
return "库别["+reelBarcode.getWarehouseCode()+"]不可放入料格["+binId+"]";
}
List<Barcode> subCodeList = boxBarcode.getSubCodeList();
if(subCodeList != null){
for (Barcode barcode : subCodeList) {
if(barcode.getPosName().equals(binId)){
//因为bin中的物料都是一样的料号,供应商,库别,过账日期,所以只需要找到Bin中的第一个物料进行比对就可以了
if(!barcode.getPartNumber().equals(reelBarcode.getPartNumber())){
return "料格中物料的料号["+barcode.getPartNumber()+"]与["+reelBarcode.getBarcode()+"]的料号["+reelBarcode.getPartNumber()+"]不一致";
}
if(!barcode.getProvider().equals(reelBarcode.getProvider())){
return "料格中物料的供应商["+barcode.getProvider()+"]与["+reelBarcode.getBarcode()+"]的供应商["+reelBarcode.getProvider()+"]不一致";
}
if(!barcode.getWarehouseCode().equals(reelBarcode.getWarehouseCode())){
return "料格中物料的库别["+barcode.getWarehouseCode()+"]与["+reelBarcode.getBarcode()+"]的库别["+reelBarcode.getWarehouseCode()+"]不一致";
}
if(!barcode.getProduceDate().equals(reelBarcode.getProduceDate())){
return "料格中物料的供应商["+barcode.getProvider()+"]与["+reelBarcode.getBarcode()+"]的供应商["+reelBarcode.getPartNumber()+"]不一致";
}
}
}
}
return "";
}
private void generatePutInTask(Barcode barcode, Barcode boxBarcode) {
DataLog dataLog = new DataLog();
......
20220225修改:
1.工单出库界面调整
2.增加:物料管理->物料入库菜 页面
3.增加:设置->料架设置 页面
20220228 增加接口:
/service/store/cidIsExists
客户端判断CID是否存在,参数:cid,返回值code=0表示存在,其他值表示不存在
/service/store/uploadStoragePos
客户端上传料仓库位列表,参数:cid,posList (库位列表)
处理:判断料仓是否存在,不存在时自动创建料仓。料仓无库位时自动上传库位,有库位时不处理。
20220228:
1.菜单页面调整。
2.库位页面调整。
3.登录页面增加语言切换。
4.共享文件夹页面调整。
20220304:
个人中心增加进入调试模式功能。
20220307:
启用禁用库位增加操作日志。
20220314:
增加移动料架:NLM,入库时自动推荐库位,无合适库位时自动合并库位。
20220318:
安全库存和 呆滞物料功能
1 入料机构获取可用料格
地址: /cdevice/validBin
>
>参数: {"stackerId":"B000009", binList:"C0700001-1,C0700001-2,C0700001-3"}
>> stackerId: 料串编号
>> binList: 料格列表, 多个料格用,分割
>
> 返回:
>>` {"code":0,"msg":"ok","data":{"validBinList":["C0700001-1","C0700001-2"]}}`
>>
>> - code: 0为正常,其他为异常(料串未绑定等), 注意, 没有可用的料格时, code为0, 不是异常
>> - msg:消息,
>> - data:
>> - validBinList: 可用的料格列表, 如果没有可用的料格, 那么列表为空
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!