List <string> GetListProviderLV(B_AccessoryDutyInfo duty, CE_LV lv) { List <string> lstResult = new List <string>(); switch (lv) { case CE_LV.A: if (duty.ProviderA != null && duty.ProviderA.Trim().Length > 0) { lstResult = duty.ProviderA.Split(',').ToList(); } break; case CE_LV.B: if (duty.ProviderB != null && duty.ProviderB.Trim().Length > 0) { lstResult = duty.ProviderB.Split(',').ToList(); } break; case CE_LV.C: if (duty.ProviderC != null && duty.ProviderC.Trim().Length > 0) { lstResult = duty.ProviderC.Split(',').ToList(); } break; default: break; } return(lstResult); }
private void txtGoodsCode_OnCompleteSearch() { if (txtGoodsCode.DataResult != null) { txtGoodsCode.Tag = Convert.ToInt32(txtGoodsCode.DataResult["序号"]); txtGoodsName.Text = txtGoodsCode.DataResult["物品名称"].ToString(); txtSpec.Text = txtGoodsCode.DataResult["规格"].ToString(); B_AccessoryDutyInfo lnqTemp = m_serviceChangeBill.GetDutyInfo(Convert.ToInt32(txtGoodsCode.Tag)); if (lnqTemp != null) { txtExplain.Text = lnqTemp.Remark; cmbProviderLV.Text = m_serviceChangeBill.GetProviderLV(Convert.ToInt32(txtGoodsCode.Tag), txtProvider.Text); txtPartType.Text = lnqTemp.Sort; cmbDiffcultyLV.Text = lnqTemp.Grade; } } else { txtGoodsCode.Tag = null; txtGoodsName.Text = ""; txtSpec.Text = ""; } }
public string GetProviderLV(int goodsID, string provider) { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; var varData = from a in ctx.B_AccessoryDutyInfo where a.GoodsID == goodsID select a; if (varData.Count() == 0) { return(null); } B_AccessoryDutyInfo duty = varData.Single(); List <string> LVA = new List <string>(); List <string> LVB = new List <string>(); List <string> LVC = new List <string>(); if (duty.ProviderA != null && duty.ProviderA.Trim().Length > 0) { LVA = duty.ProviderA.Split(',').ToList(); } if (duty.ProviderB != null && duty.ProviderB.Trim().Length > 0) { LVB = duty.ProviderB.Split(',').ToList(); } if (duty.ProviderC != null && duty.ProviderC.Trim().Length > 0) { LVC = duty.ProviderC.Split(',').ToList(); } if (LVA.Contains(provider)) { return("A"); } else if (LVB.Contains(provider)) { return("B"); } else if (LVC.Contains(provider)) { return("C"); } else { return(null); } }
/// <summary> /// 判断此物品与供应商是否通过审核 /// </summary> /// <param name="AccessoryDutyInfo">零件责任归属信息</param> /// <param name="error">出错时返回错误信息</param> /// <returns>供应商通过审核返回true,否则返回false</returns> public bool IsSafeProvider(B_AccessoryDutyInfo AccessoryDutyInfo, out string error) { error = null; try { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; var varData = from a in ctx.B_AccessoryDutyInfo where a.GoodsID == AccessoryDutyInfo.GoodsID select a; if (varData.Count() != 1) { throw new Exception("数据为空或者不唯一"); } else { B_AccessoryDutyInfo tempInfo = varData.Single(); if (tempInfo.ProviderA != null && tempInfo.ProviderA.Split(',').ToList().Contains(AccessoryDutyInfo.ProviderA)) { return(true); } if (tempInfo.ProviderB != null && tempInfo.ProviderB.Split(',').ToList().Contains(AccessoryDutyInfo.ProviderA)) { return(true); } if (tempInfo.ProviderC != null && tempInfo.ProviderC.Split(',').ToList().Contains(AccessoryDutyInfo.ProviderA)) { return(true); } } return(false); } catch (Exception ex) { error = ex.Message; return(false); } }
/// <summary> /// 结束业务 /// </summary> /// <param name="billNo">业务编号</param> public void FinishBill(string billNo) { IFlowServer serviceFlow = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>(); string billStatus = serviceFlow.GetNextBillStatus(billNo); if (billStatus == null) { throw new Exception("单据状态为空,请重新确认"); } if (billStatus != CE_CommonBillStatus.单据完成.ToString()) { return; } DepotManagementDataContext ctx = CommentParameter.DepotDataContext; ctx.Connection.Open(); ctx.Transaction = ctx.Connection.BeginTransaction(); try { Business_PurchasingMG_PartsBelongPriovderChange billInfo = GetSingleBillInfo(billNo); if (billInfo == null || billInfo.BillNo.Length == 0) { throw new Exception("此单据不存在"); } List <View_Business_PurchasingMG_PartsBelongPriovderChangeDetail> listDetail = GetListViewDetailInfo(billInfo.BillNo); foreach (View_Business_PurchasingMG_PartsBelongPriovderChangeDetail item in listDetail) { CE_LV providerLV = GlobalObject.GeneralFunction.StringConvertToEnum <CE_LV>(item.供应商等级); B_AccessoryDutyInfo lnqTemp = GetDutyInfo(ctx, item.物品ID); List <string> LVA = new List <string>(); List <string> LVB = new List <string>(); List <string> LVC = new List <string>(); switch (billInfo.ChangeType) { case "准入": if (lnqTemp == null) { lnqTemp = new B_AccessoryDutyInfo(); List <CommonProcessInfo> lstTemp = serviceFlow.GetFlowData(billInfo.BillNo); lnqTemp.CreatePersonnel = (lstTemp == null || lstTemp.Count() == 0) ? BasicInfo.LoginID : serviceFlow.GetFlowData(billInfo.BillNo).OrderBy(k => k.时间).First().人员; lnqTemp.CreateDate = ServerTime.Time; lnqTemp.Grade = item.难度等级; lnqTemp.Remark = item.说明; lnqTemp.Sort = item.零件类型; lnqTemp.GoodsID = item.物品ID; List <string> lstProvider = new List <string>(); lstProvider.Add(billInfo.Provider); SetProviderLV(ref lnqTemp, providerLV, lstProvider); ctx.B_AccessoryDutyInfo.InsertOnSubmit(lnqTemp); } else if (lnqTemp != null) { LVA = GetListProviderLV(lnqTemp, CE_LV.A); LVB = GetListProviderLV(lnqTemp, CE_LV.B); LVC = GetListProviderLV(lnqTemp, CE_LV.C); LVA.Remove(billInfo.Provider); LVB.Remove(billInfo.Provider); LVC.Remove(billInfo.Provider); switch (providerLV) { case CE_LV.A: LVA.Add(billInfo.Provider); break; case CE_LV.B: LVB.Add(billInfo.Provider); break; case CE_LV.C: LVC.Add(billInfo.Provider); break; default: break; } SetProviderLV(ref lnqTemp, CE_LV.A, LVA); SetProviderLV(ref lnqTemp, CE_LV.B, LVB); SetProviderLV(ref lnqTemp, CE_LV.C, LVC); } else { throw new Exception("信息重复,无法操作"); } break; case "等级变更": if (lnqTemp == null) { throw new Exception("无此零件信息,无法操作【等级变更】"); } LVA = GetListProviderLV(lnqTemp, CE_LV.A); LVB = GetListProviderLV(lnqTemp, CE_LV.B); LVC = GetListProviderLV(lnqTemp, CE_LV.C); LVA.Remove(billInfo.Provider); LVB.Remove(billInfo.Provider); LVC.Remove(billInfo.Provider); switch (providerLV) { case CE_LV.A: LVA.Add(billInfo.Provider); break; case CE_LV.B: LVB.Add(billInfo.Provider); break; case CE_LV.C: LVC.Add(billInfo.Provider); break; default: break; } SetProviderLV(ref lnqTemp, CE_LV.A, LVA); SetProviderLV(ref lnqTemp, CE_LV.B, LVB); SetProviderLV(ref lnqTemp, CE_LV.C, LVC); break; case "淘汰": if (lnqTemp != null) { LVA = GetListProviderLV(lnqTemp, CE_LV.A); LVB = GetListProviderLV(lnqTemp, CE_LV.B); LVC = GetListProviderLV(lnqTemp, CE_LV.C); LVA.Remove(billInfo.Provider); LVB.Remove(billInfo.Provider); LVC.Remove(billInfo.Provider); SetProviderLV(ref lnqTemp, CE_LV.A, LVA); SetProviderLV(ref lnqTemp, CE_LV.B, LVB); SetProviderLV(ref lnqTemp, CE_LV.C, LVC); if ((lnqTemp.ProviderA == null || lnqTemp.ProviderA.Length == 0) && (lnqTemp.ProviderB == null || lnqTemp.ProviderB.Length == 0) && (lnqTemp.ProviderC == null || lnqTemp.ProviderC.Length == 0)) { ctx.B_AccessoryDutyInfo.DeleteOnSubmit(lnqTemp); } } break; default: break; } ctx.SubmitChanges(); } ctx.SubmitChanges(); ctx.Transaction.Commit(); } catch (Exception ex) { ctx.Transaction.Rollback(); throw new Exception(ex.Message); } }
void SetProviderLV(ref B_AccessoryDutyInfo duty, CE_LV lv, List <string> lstProvider) { if (duty == null) { throw new Exception("数据异常"); } switch (lv) { case CE_LV.A: duty.ProviderA = ""; if (lstProvider == null || lstProvider.Count == 0) { return; } foreach (string A in lstProvider) { duty.ProviderA += A + ","; } duty.ProviderA = duty.ProviderA.Substring(0, duty.ProviderA.Length - 1); break; case CE_LV.B: duty.ProviderB = ""; if (lstProvider == null || lstProvider.Count == 0) { return; } foreach (string B in lstProvider) { duty.ProviderB += B + ","; } duty.ProviderB = duty.ProviderB.Substring(0, duty.ProviderB.Length - 1); break; case CE_LV.C: duty.ProviderC = ""; if (lstProvider == null || lstProvider.Count == 0) { return; } foreach (string C in lstProvider) { duty.ProviderC += C + ","; } duty.ProviderC = duty.ProviderC.Substring(0, duty.ProviderC.Length - 1); break; default: break; } }