public bool PostQuality(UserModel userModel, List <T_StockInfo> modelList, ref string strError, ref string QualityNo) { try { BaseMessage_Model <List <T_StockInfo> > model = new BaseMessage_Model <List <T_StockInfo> >(); bool bSucc = false; string strUserNo = string.Empty; modelList = GroupInstockDetailList(modelList); //if (TOOL.RegexMatch.isExists(userModel.UserNo) == true) //{ // strUserNo = userModel.UserNo.Substring(0, userModel.UserNo.Length - 1); //} //else //{ // strUserNo = userModel.UserNo; //} ////确定过账人,根据登录账户以及操作的订单据点来确定 //User_DB _db = new User_DB(); //string strPostUser = _db.GetPostAccountByUserNo(strUserNo, modelList[0].StrongHoldCode); modelList.ForEach(t => t.VoucherType = 20); modelList.ForEach(t => t.PostUser = userModel.UserNo);//strPostUser T_Interface_Func tfunc = new T_Interface_Func(); string ERPJson = BILBasic.JSONUtil.JSONHelper.ObjectToJson <List <T_StockInfo> >(modelList); string interfaceJson = tfunc.PostModelListToInterface(ERPJson); model = BILBasic.JSONUtil.JSONHelper.JsonToObject <BaseMessage_Model <List <T_StockInfo> > >(interfaceJson); //过账失败直接返回 if (model.HeaderStatus == "E" && !string.IsNullOrEmpty(model.Message)) { strError = "生成检验单失败!" + model.Message; bSucc = false; } else if (model.HeaderStatus == "S" && !string.IsNullOrEmpty(model.MaterialDoc)) { strError = "检验单生成成功!检验单号:" + model.MaterialDoc; QualityNo = model.MaterialDoc; bSucc = true; } return(bSucc); } catch (Exception ex) { strError = ex.Message; return(false); } }
public bool PostCheckToTrans(List <T_TransportSupDetailInfo> modelList, ref string strError) { try { BaseMessage_Model <List <T_TransportSupDetailInfo> > model = new BaseMessage_Model <List <T_TransportSupDetailInfo> >(); bool bSucc = false; string strUserNo = string.Empty; string strPostUser = string.Empty; string StrongHoldCode = string.Empty; if (modelList[0].ErpVoucherNo.Contains("HH2")) { modelList.ForEach(t => t.gtype = "C"); } else { modelList.ForEach(t => t.gtype = "A"); } StrongHoldCode = modelList[0].ErpVoucherNo.Substring(0, 3); modelList.ForEach(t => t.VoucherType = 9992); modelList.ForEach(t => t.StrongHoldCode = StrongHoldCode); T_Interface_Func tfunc = new T_Interface_Func(); string ERPJson = BILBasic.JSONUtil.JSONHelper.ObjectToJson <List <T_TransportSupDetailInfo> >(modelList); string interfaceJson = tfunc.PostModelListToInterface(ERPJson); model = BILBasic.JSONUtil.JSONHelper.JsonToObject <BaseMessage_Model <List <T_TransportSupDetailInfo> > >(interfaceJson); LogNet.LogInfo("ERPJsonAfter:" + BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <List <T_TransportSupDetailInfo> > >(model)); //过账失败直接返回 if (model.HeaderStatus == "E" && !string.IsNullOrEmpty(model.Message)) { strError = "回传T100费用失败!" + model.Message; bSucc = false; } else if (model.HeaderStatus == "S" && !string.IsNullOrEmpty(model.MaterialDoc)) //过账成功,并且生成了凭证要记录数据库 { strError = "回传T100费用成功!凭证号:" + model.MaterialDoc; bSucc = true; } return(bSucc); } catch (Exception ex) { strError = ex.Message; return(false); } }
public bool CreateQualityChangeToERP(UserModel userModel, List <T_QualityChangeDetailInfo> modelList, ref string strError) { try { BaseMessage_Model <List <T_QualityChangeDetailInfo> > model = new BaseMessage_Model <List <T_QualityChangeDetailInfo> >(); bool bSucc = false; string strUserNo = string.Empty; string strPostUser = string.Empty; string strErpVoucherNo = string.Empty; string strAftDate = string.Empty; modelList.ForEach(t => t.PostUser = userModel.UserNo); if (modelList[0].WareHouseNo.Contains("AD07") || modelList[0].WareHouseNo.Contains("AD10") || modelList[0].WareHouseNo.Contains("BH02") || modelList[0].WareHouseNo.Contains("BH03") || modelList[0].WareHouseNo.Contains("BH04") || modelList[0].WareHouseNo.Contains("BH07") || modelList[0].WareHouseNo.Contains("BH08")) { modelList.ForEach(t => t.AreaNo = " "); } T_Interface_Func tfunc = new T_Interface_Func(); string ERPJson = BILBasic.JSONUtil.JSONHelper.ObjectToJson <List <T_QualityChangeDetailInfo> >(modelList); string interfaceJson = tfunc.PostModelListToInterface(ERPJson); model = BILBasic.JSONUtil.JSONHelper.JsonToObject <BaseMessage_Model <List <T_QualityChangeDetailInfo> > >(interfaceJson); //过账失败直接返回 if (model.HeaderStatus == "E" && !string.IsNullOrEmpty(model.Message)) { strError = "ERP质量状态变更单生成失败!" + model.Message; bSucc = false; } else { strError = model.MaterialDoc; bSucc = true; } return(bSucc); } catch (Exception ex) { strError = ex.Message; return(false); } }
public bool PostCloseOutStockVoucherNo(List <T_OutStockInfo> modelList, ref string strError) { try { BaseMessage_Model <List <T_OutStockInfo> > model = new BaseMessage_Model <List <T_OutStockInfo> >(); bool bSucc = false; //string strUserNo = string.Empty; //string strPostUser = string.Empty; //string StrongHoldCode = string.Empty; //StrongHoldCode = modelList[0].ErpVoucherNo.Substring(0, 3); //modelList.ForEach(t => t.VoucherType = 50); //modelList.ForEach(t => t.WmsStatus = "E"); //modelList.ForEach(t => t.StrongHoldCode = StrongHoldCode); T_Interface_Func tfunc = new T_Interface_Func(); string ERPJson = BILBasic.JSONUtil.JSONHelper.ObjectToJson <List <T_OutStockInfo> >(modelList); LogNet.LogInfo("closeJSON:" + ERPJson); string interfaceJson = tfunc.PostModelListToInterface(ERPJson); model = BILBasic.JSONUtil.JSONHelper.JsonToObject <BaseMessage_Model <List <T_OutStockInfo> > >(interfaceJson); LogNet.LogInfo("ERPJsonAfter:" + BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <List <T_OutStockInfo> > >(model)); //过账失败直接返回 if (model.HeaderStatus == "E" && !string.IsNullOrEmpty(model.Message)) { strError = "回传T100关闭状态失败!" + model.Message; bSucc = false; } else if (model.HeaderStatus == "S" && !string.IsNullOrEmpty(model.MaterialDoc)) //过账成功,并且生成了凭证要记录数据库 { strError = "回传T100关闭状态成功!凭证号:" + model.MaterialDoc; bSucc = true; } return(bSucc); } catch (Exception ex) { strError = ex.Message; return(false); } }
public bool CreateEDateChangeToERP(UserModel userModel, List <T_EDateChangeDetailInfo> modelList, ref string strError) { try { BaseMessage_Model <List <T_EDateChangeDetailInfo> > model = new BaseMessage_Model <List <T_EDateChangeDetailInfo> >(); bool bSucc = false; string strUserNo = string.Empty; string strPostUser = string.Empty; string strErpVoucherNo = string.Empty; string strAftDate = string.Empty; modelList.ForEach(t => t.StrResoneCode = t.ResoneCode.ToString().PadLeft(3, '0')); modelList.ForEach(t => t.PostUser = userModel.UserNo); modelList.ForEach(t => t.StrAftEDate = t.AftEDate.ToDateTime().Date.ToString("yyyy-MM-dd")); T_Interface_Func tfunc = new T_Interface_Func(); string ERPJson = BILBasic.JSONUtil.JSONHelper.ObjectToJson <List <T_EDateChangeDetailInfo> >(modelList); string interfaceJson = tfunc.PostModelListToInterface(ERPJson); model = BILBasic.JSONUtil.JSONHelper.JsonToObject <BaseMessage_Model <List <T_EDateChangeDetailInfo> > >(interfaceJson); //过账失败直接返回 if (model.HeaderStatus == "E" && !string.IsNullOrEmpty(model.Message)) { strError = "ERP效期变更单生成失败!" + model.Message; bSucc = false; } else { strError = model.MaterialDoc; bSucc = true; } return(bSucc); } catch (Exception ex) { strError = ex.Message; return(false); } }
public string SaveModelListSqlToDBADF(User.UserModel user, List <TBase_Model> modelList) { BaseMessage_Model <List <TBase_Model> > model = new BaseMessage_Model <List <TBase_Model> >(); try { bool bSucc = false; string strError = ""; if (user == null) { model.HeaderStatus = "E"; model.Message = "传入用户信息为空!"; JsonConvert.SerializeObject(model); } if (CheckModelBeforeSave(modelList, ref strError) == false) { model.HeaderStatus = "E"; model.Message = strError; JsonConvert.SerializeObject(model); } T_Interface_Func tfunc = new T_Interface_Func(); string ERPJson = GetModelListByJsonToERP(user, modelList);//JSONUtil.JSONHelper.ObjectToJson<List<TBase_Model>>(modelList); LogNet.LogInfo("ERPJsonBefore:" + ERPJson); string interfaceJson = tfunc.PostModelListToInterface(ERPJson); LogNet.LogInfo("YMH00000000ERP:" + interfaceJson); model = JSONUtil.JSONHelper.JsonToObject <BaseMessage_Model <List <TBase_Model> > >(interfaceJson); LogNet.LogInfo("ERPJsonAfter:" + JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <List <TBase_Model> > >(model)); //过账失败直接返回 if (model.HeaderStatus == "E" && !string.IsNullOrEmpty(model.Message)) { return(interfaceJson); } else if (model.HeaderStatus == "S" && !string.IsNullOrEmpty(model.MaterialDoc)) //过账成功,并且生成了凭证要记录数据库 { modelList.ForEach(t => t.MaterialDoc = model.MaterialDoc); } //LogNet.LogInfo("ERPJson:" + JSONUtil.JSONHelper.ObjectToJson<List<TBase_Model>>(modelList)); bSucc = db.SaveModelListBySqlToDB(user, ref modelList, ref strError); if (bSucc == false) { model.HeaderStatus = "E"; model.Message = strError; } else { model.HeaderStatus = "S"; model.TaskNo = modelList[0].TaskNo; model.Message = GetSuccessMessage(model.MaterialDoc, modelList[0].TaskNo); } return(JsonConvert.SerializeObject(model)); } catch (Exception ex) { model.HeaderStatus = "E"; model.Message = "保存" + GetModelChineseName() + "失败!" + ex.Message + ex.TargetSite; return(JsonConvert.SerializeObject(model)); } }
public string SaveModelListSqlToDBADF(string UserJson, string ModeJson, string Guid = "", string strPost = "") { BaseMessage_Model <List <TBase_Model> > model = new BaseMessage_Model <List <TBase_Model> >(); try { string strError = ""; if (Guid != "") { if (!CheckGuid(Guid, ref strError)) { model.HeaderStatus = "E"; model.Message = "GUID已经存在,不能重复提交-" + strError; return(JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <List <TBase_Model> > >(model)); } } bool bSucc = false; if (string.IsNullOrEmpty(UserJson)) { model.HeaderStatus = "E"; model.Message = "传入用户信息为空!"; return(JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <List <TBase_Model> > >(model)); } User.UserModel user = JSONUtil.JSONHelper.JsonToObject <User.UserModel>(UserJson); user.GUID = Guid; List <TBase_Model> modelList = GetModelListByJson(UserJson, ModeJson); if (strPost != "复核") { if (CheckModelBeforeSave(modelList, ref strError) == false) { model.HeaderStatus = "E"; model.Message = strError; return(JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <List <TBase_Model> > >(model)); } } //是否过账 if (string.IsNullOrEmpty(strPost) || (strPost == "下架" && (modelList[0].VoucherType == 31 || modelList[0].VoucherType == 53)) || strPost == "复核") { T_Interface_Func tfunc = new T_Interface_Func(); string ERPJson = GetModelListByJsonToERP(user, modelList, strPost);//JSONUtil.JSONHelper.ObjectToJson<List<TBase_Model>>(modelList); //LogNet.LogInfo("-----------------------ERPJsonBefore:" + ERPJson); string interfaceJson = tfunc.PostModelListToInterface(ERPJson); model = JSONUtil.JSONHelper.JsonToObject <BaseMessage_Model <List <TBase_Model> > >(interfaceJson); //LogNet.LogInfo("-----------------------ERPJsonAfter:" + JSONUtil.JSONHelper.ObjectToJson<BaseMessage_Model<List<TBase_Model>>>(model)); //过账失败直接返回 if (model.HeaderStatus == "E" && !string.IsNullOrEmpty(model.Message)) { return(interfaceJson); } else if (model.HeaderStatus == "S" && !string.IsNullOrEmpty(model.MaterialDoc)) //过账成功,并且生成了凭证要记录数据库 { modelList.ForEach(t => t.MaterialDoc = model.MaterialDoc); } } //modelList.ForEach(t => t.MaterialDoc = "Wgr0401210221054"); //LogNet.LogInfo("ERPJson:" + JSONUtil.JSONHelper.ObjectToJson<List<TBase_Model>>(modelList)); //LogNet.LogInfo("------------------------ymh:ERPtoWMS-" + JSONUtil.JSONHelper.ObjectToJson<List<TBase_Model>>(modelList)); bSucc = db.SaveModelListBySqlToDB(user, ref modelList, ref strError, strPost); if (bSucc == false) { model.HeaderStatus = "E"; model.Message = strError; //LogInfo.ErrorLog("------------------WMS失败:单号:【"+ modelList[0].ErpVoucherNo==null?"":modelList[0].ErpVoucherNo + "】错误信息:"+ strError); LogNet.LogInfo("------------------ymh:WMS-失败:单号:【" + modelList[0].ErpVoucherNo == null ? "" : modelList[0].ErpVoucherNo + "】错误信息:" + strError); } else { model.HeaderStatus = "S"; model.TaskNo = modelList[0].TaskNo; model.Message = GetSuccessMessage(model.MaterialDoc, modelList[0].TaskNo); LogNet.LogInfo("-----------------ymh:WMS-成功:单号:【" + modelList[0].ErpVoucherNo == null ? "" : modelList[0].ErpVoucherNo + "】"); } return(JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <List <TBase_Model> > >(model)); } catch (Exception ex) { //LogInfo.ErrorLog("------------------WMS失败:错误信息:" + ex.ToString()); LogNet.LogInfo("------------------ymh:WMS-失败:错误信息:" + ex.ToString()); model.HeaderStatus = "E"; model.Message = "保存" + GetModelChineseName() + "失败!" + ex.Message + ex.TargetSite; return(JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <List <TBase_Model> > >(model)); } }