private void NewFixJudge() { DataRow drRow = this.dt_Return.NewRow(); //获取维修单号 string wxno = this.dtList.Rows[0]["WXNo"].ToString(); string warehouse = this.dtList.Rows[0]["Warehouse"].ToString(); wxno = FilterSpecial(wxno); warehouse = FilterSpecial(warehouse); string selectMain = @"SELECT [ID] ,[WXNo] ,[DepotId] ,[CreateUser] ,[SKU] ,[Status] ,[WarehouseNo] ,[ModifyTime] ,[ModifyUser] FROM [dbo].[SPWX_Main] WITH(NOLOCK) WHERE [Status] = '20' AND [WXNo] = @Param0 "; //创建连接对象 DBHandle dbh = new DBHandle("SPWX"); //获取主表状态 DataTable dtMain = dbh.GetData(selectMain,new object[]{wxno}); //判断有无初判数据 if (dtMain.Rows.Count > 0) { //获取交易表表头 DataTable dtHist = dbh.GetTabHead("[dbo].[SPWX_Hist]"); DataRow dr = dtHist.NewRow(); dr["WXNo"] = wxno; dr["BeforeStatus"] = dtMain.Rows[0]["Status"].ToString(); dr["AfterStatus"] = "25"; dr["Content"] = "操作内容:完成初判"; dr["ModifyUser"] = base.m_hzyMessage.User_Name; dtHist.Rows.Add(dr); //修改主表状态,修改人 dtMain.Rows[0]["Status"] = "25"; dtMain.Rows[0]["ModifyUser"] = base.m_hzyMessage.User_Name; dtMain.Rows[0]["ModifyTime"] = timeNow.ToString(); //获取维修价格和时间 string value = this.dtList.Rows[0]["FirstPhen"].ToString(); value = FilterSpecial(value); DataTable dtMD = GetMoneyDay(value); //新插入表 this.dtList.Columns.Add("CreateUser"); this.dtList.Columns.Add("ModifyUser"); this.dtList.Rows[0]["FixNeedTime"] = dtMD.Rows[0]["Day"].ToString(); this.dtList.Rows[0]["FixNeedMoney"] = dtMD.Rows[0]["Money"].ToString(); this.dtList.Rows[0]["CreateUser"] = base.m_hzyMessage.User_Name; this.dtList.Rows[0]["ModifyUser"] = base.m_hzyMessage.User_Name; //调用退仓单 if (warehouse.Length > 0) { string DepotId = dtMain.Rows[0]["DepotId"].ToString(); string CreateUser = dtMain.Rows[0]["CreateUser"].ToString(); string sku = dtMain.Rows[0]["SKU"].ToString(); string sendUser = base.m_hzyMessage.User_Name; string WarehouseNo = dtMain.Rows[0]["WarehouseNo"].ToString(); DBHandle dbhGP = new DBHandle("F22GP"); object[] paramObj = new object[4]; object[] paramVal = new object[4]; paramObj[0] = SParam.InputFormat; paramObj[1] = SParam.OutputFormat; paramObj[2] = SParam.OutputContentType; paramObj[3] = SParam.ConditionStr; paramVal[0] = "AML"; paramVal[1] = "DB"; paramVal[2] = "RS"; paramVal[3] = @"【操作类型,NEW】【实体,发货】 【新增内容,发货店铺ID,收货店铺ID,装箱号,款号,款式编号,颜色,尺码,退货数量,成本, 原价,现价,结算价,折扣,登记人,发货操作员,收货操作员】 【条件内容,《N》发货店铺ID,《N》收货店铺ID,《N》装箱号,《N》款号,《N》款式编号, 《N》颜色,《N》尺码,《N》退货数量,《N》成本,《N》原价,《N》现价,《N》结算价,《N》折扣, 《N》登记人,《N》发货操作员,《N》收货操作员 】 【《N》维修单号," + wxno + "】【《N》发货店铺ID," + DepotId + "】【《N》收货店铺ID," + WarehouseNo + @"】 【《N》装箱号," + sendUser + "】【《N》款号," + sku + @"】【《N》款式编号,】【《N》颜色,】 【《N》尺码,】【《N》退货数量,1】【《N》成本,0】【《N》原价,0】【《N》现价,0】【《N》结算价,0】 【《N》折扣,0】【《N》登记人," + sendUser + "】【《N》发货操作员," + sendUser + "】【《N》收货操作员,】"; DataTable dtRtn = dbhGP.GetDataBySP("[API_Bill].[Thd_Info]", paramObj, paramVal); if (dtRtn != null) { if (dtRtn.Rows.Count > 0) { string result = dtRtn.Rows[0]["FLAG"].ToString(); if (result.ToUpper() == "TRUE") { string returnNo = dtRtn.Rows[0]["outindentid"].ToString(); this.dtList.Columns.Add("ReturnNo"); this.dtList.Rows[0]["ReturnNo"] = returnNo; //调用收货的过程 paramVal[3] = @"【操作类型,NEW】【实体,收货】 【新增内容,退货单号,发货店铺ID,收货店铺ID,装箱号,款号,款式编号,颜色,尺码,退货数量,成本, 原价,现价,结算价,折扣,登记人,发货操作员,收货操作员】 【条件内容,《N》退货单号,《N》发货店铺ID,《N》收货店铺ID,《N》装箱号,《N》款号,《N》款式编号, 《N》颜色,《N》尺码,《N》退货数量,《N》成本,《N》原价,《N》现价,《N》结算价,《N》折扣,《N》登记人, 《N》发货操作员,《N》收货操作员 】【《N》退货单号," + returnNo + "】【《N》发货店铺ID," + DepotId + @"】 【《N》收货店铺ID," + WarehouseNo + "】【《N》装箱号," + sendUser + "】【《N》款号," + sku + @"】【《N》款式编号,】 【《N》颜色,】【《N》尺码,】【《N》退货数量,1】【《N》成本,0】【《N》原价,0】【《N》现价,0】 【《N》结算价,0】【《N》折扣,0】【《N》登记人," + CreateUser + "】【《N》发货操作员,】【《N》收货操作员," + sendUser + "】"; DataTable dtClt = dbhGP.GetDataBySP("[API_Bill].[Thd_Info]", paramObj, paramVal); if (dtClt != null) { if (dtClt.Rows.Count > 0) { if (dtClt.Rows[0]["FLAG"].ToString().ToUpper() == "TRUE") { DataTable dtHead = this.dtList.Copy(); dtHead.TableName = "[dbo].[SPWX_Headquarters]"; dtMain.TableName = "[dbo].[SPWX_Main]"; dtHist.TableName = "[dbo].[SPWX_Hist]"; DataSet ds = new DataSet(); ds.Tables.Add(dtHead); ds.Tables.Add(dtMain); ds.Tables.Add(dtHist); this.bRst = dbh.UpdateDB("ID", ds); if (this.bRst) { drRow["result"] = true; drRow["message"] = "提交成功"; } else { drRow["result"] = false; drRow["message"] = "提交失败"; }; } else { string msg = dtRtn.Rows[0]["message"].ToString(); drRow["result"] = false; drRow["message"] = msg; }; } else { drRow["result"] = false; drRow["message"] = "收货单生成失败,请联系信息管理部。"; }; } else { drRow["result"] = false; drRow["message"] = "收货单生成失败,请联系信息管理部。"; }; } else { string msg = dtRtn.Rows[0]["message"].ToString(); drRow["result"] = false; drRow["message"] = msg; }; } else { drRow["result"] = false; drRow["message"] = "退货单生成失败,请联系信息管理部。"; }; } else { drRow["result"] = false; drRow["message"] = "退货单生成失败,请联系信息管理部。"; }; } else { DataTable dtHead = this.dtList.Copy(); dtHead.TableName = "[dbo].[SPWX_Headquarters]"; dtMain.TableName = "[dbo].[SPWX_Main]"; dtHist.TableName = "[dbo].[SPWX_Hist]"; DataSet ds = new DataSet(); ds.Tables.Add(dtHead); ds.Tables.Add(dtMain); ds.Tables.Add(dtHist); this.bRst = dbh.UpdateDB("ID", ds); if (this.bRst) { drRow["result"] = true; drRow["message"] = "提交成功"; } else { drRow["result"] = false; drRow["message"] = "提交失败"; }; }; } else { drRow["result"] = false; drRow["message"] = "在初判表中已经无法找到该维修单号,请确认。"; }; this.dt_Return.Rows.Add(drRow); this.ds_Return.Tables.Add(this.dt_Return); }
//HWA #region 检查快递单号 private void CheckExpNo() { DataTable dtChk = this.dtList.Copy(); DataTable dtRst = new DataTable(); string ExpNo = ""; string WxNo = ""; if (dtChk.Columns.Contains("ExpNo")) { ExpNo = dtChk.Rows[0]["ExpNo"].ToString(); ExpNo = FilterSpecial(ExpNo); ExpNo = ExpNo.ToUpper(); } else if (dtChk.Columns.Contains("WxNo")) { WxNo = dtChk.Rows[0]["WxNo"].ToString(); WxNo = FilterSpecial(WxNo); }; string DepotId = base.m_hzyMessage.User_Name_CN.Split('_')[0]; string select = ""; bool b = Convert.ToChar(DepotId.Substring(0, 1)) <= 'Z'; if (b)//店铺 { if (ExpNo.Length > 0) { select = @"SELECT T1.[ID] ,T1.[WXNo] ,T1.[Status] ,T1.[ModifyTime] ,T1.[ModifyUser] FROM [dbo].[SPWX_Main] T1 LEFT JOIN [dbo].[SPWX_Headquarters] T2 ON T1.[WXNo] = T2.[WXNo] WHERE T1.[Status] = 45 AND T1.[DepotId] = '" + DepotId + "' AND T2.[ExpNo] = @Param0"; } else if (WxNo.Length > 0) { select = @"SELECT T1.[ID] ,T1.[WXNo] ,T1.[Status] ,T1.[ModifyTime] ,T1.[ModifyUser] FROM [dbo].[SPWX_Main] T1 LEFT JOIN [dbo].[SPWX_Headquarters] T2 ON T1.[WXNo] = T2.[WXNo] WHERE T1.[Status] = 45 AND T1.[DepotId] = '" + DepotId + "' AND T1.[WxNo] = @Param0"; }; } else { if (ExpNo.Length > 0) { select = @"SELECT [ID] ,[WXNo] ,[Status] ,[ModifyTime] ,[ModifyUser] FROM [dbo].[SPWX_Main] WHERE [Status] = '16' AND [ExpressNo] = @Param0"; } else if(WxNo.Length >0) { select = @"SELECT [ID] ,[WXNo] ,[Status] ,[ModifyTime] ,[ModifyUser] FROM [dbo].[SPWX_Main] WHERE [Status] = '16' AND [WXNo] = @Param0"; }; }; DBHandle dbh = new DBHandle("SPWX"); if (ExpNo.Length > 0) { dtRst = dbh.GetData(select, new object[1] { ExpNo }); } else if (WxNo.Length > 0) { dtRst = dbh.GetData(select, new object[1] { WxNo }); }; if (dtRst.Rows.Count > 0) { DataTable dtHist = dbh.GetTabHead("[dbo].[SPWX_Hist]"); for (int i = 0; i < dtRst.Rows.Count; i++) { //交易表 DataRow drHist = dtHist.NewRow(); drHist["WXNo"] = dtRst.Rows[i]["WXNo"].ToString(); drHist["BeforeStatus"] = dtRst.Rows[i]["Status"].ToString(); if (b) { drHist["AfterStatus"] = "50"; drHist["Content"] = "操作内容:店铺已经收货"; } else { drHist["AfterStatus"] = "20"; drHist["Content"] = "操作内容:维修单已经收货"; }; drHist["ModifyTime"] = this.timeNow; drHist["ModifyUser"] = base.m_hzyMessage.User_Name; dtHist.Rows.Add(drHist); //主表 if (b) { dtRst.Rows[i]["Status"] = "50"; } else { dtRst.Rows[i]["Status"] = "20"; }; dtRst.Rows[i]["ModifyTime"] = this.timeNow; dtRst.Rows[i]["ModifyUser"] = base.m_hzyMessage.User_Name; }; dtRst.TableName = "[dbo].[SPWX_Main]"; dtHist.TableName = "[dbo].[SPWX_Hist]"; DataSet ds = new DataSet(); ds.Tables.Add(dtRst); ds.Tables.Add(dtHist); this.bRst = dbh.UpdateDB("ID", ds); }; DataRow drRow = this.dt_Return.NewRow(); if (this.bRst) //if (dt.Rows.Count >0) { drRow["result"] = true; drRow["message"] = "成功"; } else { drRow["result"] = false; drRow["message"] = "失败"; }; this.dt_Return.Rows.Add(drRow); this.ds_Return.Tables.Add(this.dt_Return); }