| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 余料解绑出库 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | internal static SimpleResult SurplusUnBind(SurplusUnBindInfo model) |
| | | { |
| | | LogHelper.Info("触发API:余料绑定入库" + JsonConvert.SerializeObject(model), "API"); |
| | | var result = new SimpleResult();//返回结果 |
| | | try |
| | | { |
| | | if (string.IsNullOrWhiteSpace(model.spec)) |
| | | { |
| | | result.resultCode = -1; |
| | | result.resultMsg = $"规格参数不能为空,也不能为空字符串"; |
| | | LogHelper.Info(result.resultMsg); |
| | | return result; |
| | | } |
| | | |
| | | if (string.IsNullOrWhiteSpace(model.loc)) |
| | | { |
| | | result.resultCode = -1; |
| | | result.resultMsg = $"货位参数不能为空,也不能为空字符串"; |
| | | LogHelper.Info(result.resultMsg); |
| | | return result; |
| | | } |
| | | |
| | | if (model.weight <= 0) |
| | | { |
| | | result.resultCode = -1; |
| | | result.resultMsg = $"重量参数必须大于0"; |
| | | LogHelper.Info(result.resultMsg); |
| | | return result; |
| | | } |
| | | |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | | |
| | | |
| | | var cgDetail = db.Queryable<TN_CG_Detail>() |
| | | .First(a => a.S_LOC_CODE == model.loc |
| | | && a.S_USE_TYPE == "余料" |
| | | &&(a.S_ITEM_SPEC == model.spec || a.S_SPE == model.spec) |
| | | && a.F_QTY == model.weight); |
| | | |
| | | if (cgDetail == null) |
| | | { |
| | | result.resultCode = -1; |
| | | result.resultMsg = $"库位{model.loc}对应的物料明细不存在,无需出库"; |
| | | LogHelper.Info(result.resultMsg); |
| | | return result; |
| | | } |
| | | |
| | | using (var trans = db.Ado.UseTran()) |
| | | { |
| | | if (db.Deleteable<TN_CG_Detail>(cgDetail).ExecuteCommand() > 0 ) |
| | | { |
| | | trans.CommitTran(); |
| | | result.resultCode = 0; |
| | | result.resultMsg = $"出库成功,货位:{model.loc},解绑的货品为:{JsonConvert.SerializeObject(cgDetail)}"; |
| | | LogHelper.Info(result.resultMsg); |
| | | return result; |
| | | } |
| | | else |
| | | { |
| | | trans.RollbackTran(); |
| | | result.resultCode = -1; |
| | | result.resultMsg = $"出库失败,货位:{model.loc}"; |
| | | LogHelper.Info(result.resultMsg); |
| | | return result; |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | result.resultCode = -1; |
| | | result.resultMsg = $"PDA满托复检判断,发生了异常:{ex.Message}"; |
| | | LogHelper.Info(result.resultMsg); |
| | | return result; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 余料绑定入库 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | internal static SimpleResult SurplusBind(SurplusBindInfo model) |
| | | { |
| | | LogHelper.Info("触发API:余料绑定入库" + JsonConvert.SerializeObject(model), "API"); |
| | | var result = new SimpleResult();//返回结果 |
| | | try |
| | | { |
| | | if (string.IsNullOrWhiteSpace(model.spec)) |
| | | { |
| | | result.resultCode = -1; |
| | | result.resultMsg = $"规格参数不能为空,也不能为空字符串"; |
| | | LogHelper.Info(result.resultMsg); |
| | | return result; |
| | | } |
| | | |
| | | if (string.IsNullOrWhiteSpace(model.loc)) |
| | | { |
| | | result.resultCode = -1; |
| | | result.resultMsg = $"货位参数不能为空,也不能为空字符串"; |
| | | LogHelper.Info(result.resultMsg); |
| | | return result; |
| | | } |
| | | |
| | | if (model.weight <= 0) |
| | | { |
| | | result.resultCode = -1; |
| | | result.resultMsg = $"重量参数必须大于0"; |
| | | LogHelper.Info(result.resultMsg); |
| | | return result; |
| | | } |
| | | |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | | |
| | | var cgDetail = new TN_CG_Detail() |
| | | { |
| | | S_ITEM_SPEC = model.spec, |
| | | S_SPE = model.spec, |
| | | F_QTY = model.weight, |
| | | S_LOC_CODE = model.loc, |
| | | S_USE_TYPE = "余料", |
| | | }; |
| | | |
| | | using (var trans = db.Ado.UseTran()) |
| | | { |
| | | if (db.Insertable<TN_CG_Detail>(cgDetail).ExecuteCommand() > 0 ) |
| | | { |
| | | trans.CommitTran(); |
| | | result.resultCode = 0; |
| | | result.resultMsg = $"入库成功,货位:{model.loc},已绑定货品,{JsonConvert.SerializeObject(cgDetail)}"; |
| | | LogHelper.Info(result.resultMsg); |
| | | return result; |
| | | } |
| | | else |
| | | { |
| | | trans.RollbackTran(); |
| | | result.resultCode = -1; |
| | | result.resultMsg = $"入库失败,货位:{model.loc}"; |
| | | LogHelper.Info(result.resultMsg); |
| | | return result; |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | result.resultCode = -1; |
| | | result.resultMsg = $"PDA满托复检判断,发生了异常:{ex.Message}"; |
| | | LogHelper.Info(result.resultMsg); |
| | | return result; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 线边空托到空托堆叠区 |
| | | /// </summary> |
| | | /// <param name="model"></param> |