| | |
| | | |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 1.创建入库任务 |
| | | /// </summary> |
| | |
| | | result.ResultCode = 1; |
| | | result.ResultMsg = "物料信息不能为空"; |
| | | return result; |
| | | } |
| | | else |
| | | { |
| | | foreach (var item in itemInfos) |
| | | { |
| | | // 将MES的物料状态转化成WMS可识别的物料状态 |
| | | if (item.jdge == "" || item.jdge == null) |
| | | { |
| | | item.jdge = "OK"; |
| | | } |
| | | else if(item.jdge != "OK") |
| | | { |
| | | item.jdge = "HOLD"; |
| | | } |
| | | |
| | | // 计算生效时间、失效时间 |
| | | var overage = WMSHelper.getOverage(item.bc_entried); |
| | | LogHelper.Info($"计算生效时间、失效时间,返回值:{JsonConvert.SerializeObject(overage)}", "WMS"); |
| | | if (overage != null) |
| | | { |
| | | DateTime txndate = DateTime.Parse(item.txndate); |
| | | DateTime minTime = txndate.AddHours(overage.MINHOUR); |
| | | DateTime maxTime = txndate.AddDays(overage.OVERAGE); |
| | | item.effective_time = minTime.ToString("yyyy-MM-dd HH:mm:ss"); |
| | | item.expiration_time = maxTime.ToString("yyyy-MM-dd HH:mm:ss"); |
| | | } |
| | | else |
| | | { |
| | | result.ResultCode = 1; |
| | | result.ResultMsg = $"未查询到物料存放时间配置信息,条形码:{item.bc_entried}"; |
| | | return result; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | if (endLoc != null) |
| | | { |
| | | string taskType = "成型机叫料出库任务"; |
| | | if (model.taskType == 2) |
| | | { |
| | | taskType = "抽检叫料出库任务"; |
| | | } |
| | | |
| | | |
| | | var wmsTask = new WMSTask() |
| | | { |
| | | S_CNTR_CODE = descCntrCode, |
| | |
| | | S_START_AREA = startLoc.S_AREA_CODE, |
| | | S_END_LOC = endLoc.S_CODE, |
| | | S_END_AREA = endLoc.S_AREA_CODE, |
| | | S_TYPE = "成型机叫料出库任务", |
| | | S_TYPE = taskType, |
| | | S_OP_DEF_CODE = model.taskNo, |
| | | S_OP_DEF_NAME = "成型机叫料出库任务", |
| | | S_OP_DEF_NAME = "叫料出库任务", |
| | | N_PRIORITY = model.priority, |
| | | T_START_TIME = DateTime.Now, |
| | | }; |
| | |
| | | ReturnResult result = new ReturnResult(); |
| | | try |
| | | { |
| | | if(model.itemInfo != null && model.itemInfo.Count > 0) |
| | | { |
| | | foreach (var item in model.itemInfo) |
| | | { |
| | | // 将MES的物料状态转化成WMS可识别的物料状态 |
| | | if (item.jdge == "" || item.jdge == null) |
| | | { |
| | | item.jdge = "OK"; |
| | | } |
| | | else if (item.jdge != "OK") |
| | | { |
| | | item.jdge = "HOLD"; |
| | | } |
| | | |
| | | var overage = WMSHelper.getOverage(item.bc_entried); |
| | | if (overage != null && overage.OVERAGE != 0) |
| | | { |
| | | DateTime txndate = DateTime.Parse(item.txndate); |
| | | DateTime minTime = txndate.AddHours(overage.MINHOUR); |
| | | DateTime maxTime = txndate.AddDays(overage.OVERAGE); |
| | | item.effective_time = minTime.ToString("yyyy-MM-dd HH:mm:ss"); |
| | | item.expiration_time = maxTime.ToString("yyyy-MM-dd HH:mm:ss"); |
| | | } |
| | | else |
| | | { |
| | | result.ResultCode = 1; |
| | | result.ResultMsg = $"未查询到物料存放时间配置信息,条形码:{item.bc_entried}"; |
| | | return result; |
| | | } |
| | | } |
| | | } |
| | | |
| | | var container = ContainerHelper.GetCntr(model.trayCode); |
| | | if (container != null) |
| | | if (container != null) |
| | | { |
| | | Location startLoc = LocationHelper.GetLoc(model.startLoc); |
| | | Location endLoc = WMSHelper.GetInstockEndLoc(container.N_TYPE, model.startLoc, 2); |
| | |
| | | else |
| | | { |
| | | result.ResultCode = 1; |
| | | result.ResultMsg = "没有空余的货位"; |
| | | result.ResultMsg = "立库没有空余的货位"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | result.ResultCode = 1; |
| | | result.ResultMsg = "WMS系统中没有该容器"; |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | { |
| | | S_ITEM = matl.item, |
| | | S_BC_ENTRIED = matl.bc_entried, |
| | | S_TOOLING_CODE = matl.toolineCode, |
| | | S_MCN = matl.mcn, |
| | | S_OPR = matl.opr, |
| | | TXNDATE = DateTime.Parse(matl.txndate, enGB) , |
| | | S_SHIFT = matl.shift, |
| | | N_QTY = matl.qty, |
| | | N_STOCK = matl.stock, |
| | | S_LOKASI = matl.lokasi, |
| | | S_SARANA = matl.sarana, |
| | | BOM1 = matl.bom1, |
| | | BOM2 = matl.bom2, |
| | | BOM3 = matl.bom3, |
| | | S_FOVRAGE = matl.fovrage, |
| | | S_JDGE = matl.jdge, |
| | | N_OVERAGE = matl.overagv, |
| | | N_MINHOUR = matl.minhour, |
| | | N_PRODUCT_TYPE_CODE = matl.productTypeCode, |
| | | LAST_MODIFY_TIME = matl.last_modify_time |
| | | }; |
| | | itemBarcodeInfos.Add(itemBarcodeInfo); |
| | |
| | | if (!bo) |
| | | { |
| | | responseResult.ResultCode = 1; |
| | | responseResult.ResultMsg = "同步物料条码信息失败"; |
| | | responseResult.ResultMsg = "同步GT条码物料信息失败"; |
| | | } |
| | | return responseResult; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 同步物料状态信息 |
| | | /// 同步条码状态信息 |
| | | /// </summary> |
| | | /// <param name="updateMatlStatuses"></param> |
| | | /// <returns></returns> |
| | | public static ReturnResult synUpdateMatlStatus(List<UpdateMatlStatus> updateMatlStatuses) |
| | | public static ReturnResult synBarcodeStatus(List<UpdateMatlStatus> updateMatlStatuses) |
| | | { |
| | | ReturnResult responseResult = new ReturnResult(); |
| | | var bo = WMSHelper.batchUpdateItemStatus(updateMatlStatuses); |
| | | if (!bo) |
| | | List<iWMS_semi_bld_BCstatus> list = new List<iWMS_semi_bld_BCstatus> (); |
| | | if (updateMatlStatuses.Count > 0) |
| | | { |
| | | responseResult.ResultCode = 1; |
| | | responseResult.ResultMsg = "同步物料状态信息失败"; |
| | | } |
| | | return responseResult; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 同步更新物料存放时间配置信息 |
| | | /// </summary> |
| | | /// <param name="overages"></param> |
| | | /// <returns></returns> |
| | | public static ReturnResult synUpdateMatlTimeConfig(List<MatlOverage> overages) |
| | | { |
| | | ReturnResult responseResult = new ReturnResult(); |
| | | if (overages != null && overages.Count > 0) |
| | | { |
| | | List<Overage> overageList = new List<Overage>(); |
| | | foreach (var item in overages) |
| | | foreach (var item in updateMatlStatuses) |
| | | { |
| | | Overage overage = new Overage |
| | | iWMS_semi_bld_BCstatus bCstatus = new iWMS_semi_bld_BCstatus() |
| | | { |
| | | MCNGRP = item.mcngrp, |
| | | ITEMPATT = item.itempatt, |
| | | OVERAGE = item.overage, |
| | | MINHOUR = float.Parse(item.minhour.ToString()), |
| | | FLAG_STS = item.flag_sts, |
| | | RECID = item.recid, |
| | | S_BC_ENTRIED = item.bc_entried, |
| | | S_MCNGRP = item.mcngrp, |
| | | S_JDGE = item.jdge, |
| | | LAST_MODIFY_TIME = item.last_modify_time |
| | | }; |
| | | overageList.Add(overage); |
| | | list.Add(bCstatus); |
| | | } |
| | | var bo = WMSHelper.batchUpdateMatlTimeConfig(overageList); |
| | | |
| | | var bo = WMSHelper.synBarcodeStatus(list); |
| | | if (!bo) |
| | | { |
| | | responseResult.ResultCode = 1; |
| | | responseResult.ResultMsg = "同步物料状态信息失败"; |
| | | responseResult.ResultMsg = "同步条码状态信息失败"; |
| | | } |
| | | } |
| | | return responseResult; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 记录数据同步时间 |
| | | /// 同步条码状态信息 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <param name="updateMatlStatuses"></param> |
| | | /// <returns></returns> |
| | | public static ReturnResult recordDataSynTime(RecordDataSynTimeModel model) |
| | | public static ReturnResult synSamplingStatus(List<UpdateMatlStatus> updateMatlStatuses) |
| | | { |
| | | ReturnResult responseResult = new ReturnResult(); |
| | | SynDataTimeRecord record = new SynDataTimeRecord() |
| | | List<iWMS_semi_bld_BCsample> list = new List<iWMS_semi_bld_BCsample>(); |
| | | if (updateMatlStatuses.Count > 0) |
| | | { |
| | | S_SYN_TIME = model.sysTime, |
| | | N_SYN_NUM = model.synNum, |
| | | RECORD_TABLE = model.recordTable |
| | | }; |
| | | var bo = WMSHelper.addSynDataTimeReord(record); |
| | | if (!bo) |
| | | { |
| | | responseResult.ResultCode = 1; |
| | | responseResult.ResultMsg = "记录数据同步时间失败"; |
| | | foreach (var item in updateMatlStatuses) |
| | | { |
| | | iWMS_semi_bld_BCsample bCstatus = new iWMS_semi_bld_BCsample() |
| | | { |
| | | S_BC_ENTRIED = item.bc_entried, |
| | | S_MCNGRP = item.mcngrp, |
| | | S_JDGE = item.jdge, |
| | | LAST_MODIFY_TIME = item.last_modify_time |
| | | }; |
| | | list.Add(bCstatus); |
| | | } |
| | | |
| | | var bo = WMSHelper.synSamplingStatus(list); |
| | | if (!bo) |
| | | { |
| | | responseResult.ResultCode = 1; |
| | | responseResult.ResultMsg = "同步条码状态信息失败"; |
| | | } |
| | | } |
| | | return responseResult; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 查询上一次的数据同步时间 |
| | | /// </summary> |
| | | /// <param name="recordTable"></param> |
| | | /// <param name="tableType"></param> |
| | | /// <returns></returns> |
| | | public static ReturnResult findLastDataSynTime(string recordTable) |
| | | public static ReturnResult findDataLastSynTime(int tableType) |
| | | { |
| | | ReturnResult responseResult = new ReturnResult(); |
| | | var synDataTime = WMSHelper.getLastDataSynTime(recordTable); |
| | | if (synDataTime != null) |
| | | { |
| | | Dictionary<string, string> map = new Dictionary<string, string>(); |
| | | map.Add("S_SYN_TIME", synDataTime.S_SYN_TIME); |
| | | map.Add("RECORD_TABLE", synDataTime.RECORD_TABLE); |
| | | responseResult.data = map; |
| | | } |
| | | var synDataTime = WMSHelper.getDataLastSynTime(tableType); |
| | | responseResult.data = synDataTime; |
| | | return responseResult; |
| | | } |
| | | |
| | |
| | | public class CreateOutOrderModel |
| | | { |
| | | public string taskNo { get; set; } // 任务号 |
| | | public string trayCode { get; set; } // 任务号 |
| | | public string trayCode { get; set; } // 托盘号 |
| | | public string itemCode { get; set; } // 物料编码 |
| | | public string endLoc { get; set; } // 终点货位 |
| | | public int priority { get; set; } = 0; // 优先级 默认0 |
| | | public int taskType { get; set; } = 1; // 1.成型机叫料任务 2.抽检出库任务 |
| | | } |
| | | |
| | | public class EmptyTrayOutOrderModel |
| | |
| | | { |
| | | public string item { get; set; } // 物品代码 |
| | | public string bc_entried { get; set; } // 条形码编号 |
| | | public string toolineCode { get; set; } // 工装条码 |
| | | public string mcn { get; set; } // 机器代码编号 |
| | | public string opr { get; set; } // 操作员 |
| | | public string txndate { get; set; } // 生产时间 |
| | | public string shift { get; set; } // 工作班次 |
| | | public int qty { get; set; } // 产品数量 |
| | | public string sarana { get; set; } // 产品材料的托盘/盒/推车/货车ID |
| | | public string fovrage { get; set; } // 是否过期的状态 Y=过期,N=未过期 |
| | | public string jdge { get; set; } // 质量状态 OK=产品合格,NG=产品不合格,HLM=产品待定 |
| | | public string effective_time { get; set; } // 生效时间 (yyyy-MM-dd HH:mm:ss) |
| | | public string expiration_time { get; set; } // 失效时间 (yyyy-MM-dd HH:mm:ss) |
| | | public string jdge { get; set; } // 质量状态 OK=产品合格,HOLD = 产品待定 |
| | | public int overage { get; set; } // 生效时间 (yyyy-MM-dd HH:mm:ss) |
| | | public int minhour { get; set; } // 失效时间 (yyyy-MM-dd HH:mm:ss) |
| | | public int productTypeCode { get; set; } // 失效时间 (yyyy-MM-dd HH:mm:ss) |
| | | } |
| | | |
| | | |