protected void Page_Load(object sender, EventArgs e) { string db = ConfigurationManager.AppSettings["ExamineDB"]; op = RequestData.Get <string>("op"); id = RequestData.Get <string>("id"); type = RequestData.Get <string>("type"); DeliveryOrder ent = null; IList <string> strList = RequestData.GetList <string>("data"); switch (this.RequestAction) { case RequestActionEnum.Update: ent = this.GetMergedData <DeliveryOrder>(); if (type == "xg") { ent.DoUpdate(); } else if (type == "ck") { UpdateStockInfo(strList, ent); //更新库存及唯一编号 if (ent.DeliveryType == "换货出库") { ChangeProduct dorder = ChangeProduct.TryFind(ent.PId); if (dorder != null) { if ((dorder.State + "").Contains("已入库")) { dorder.State = "已完成"; } else { dorder.State += ",仓库已出库:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm"); } dorder.DoSave(); } } //更新子商品信息(先删除,再添加) DelieryOrderPart.DeleteAll("DId='" + ent.Id + "'"); //删除DeliveryOrderPart //添加出库商品信息并更新出库单状态 ent.State = InsertPart(strList, ent.Id); ent.DoUpdate(); if (ent.DeliveryType == "调拨出库") //add by phg 20120519 跟出库单的状态保持一致 { WarehouseExchange weEnt = WarehouseExchange.Find(ent.PId); weEnt.OutWarehouseState = ent.State; weEnt.DoUpdate(); } //更新SaleOrder表出库状态 DataHelper.ExecSql("update " + db + "..SaleOrders set DeState=" + db + ".dbo.fun_getDeliveryState(Id) where id='" + ent.PId + "'"); } break; default: break; } if (RequestActionString == "getSalesman") { string cid = RequestData.Get <string>("CId"); Customer customer = Customer.Find(cid); if (customer != null) { PageState.Add("MagUser", customer.MagUser); PageState.Add("MagId", customer.MagId); PageState.Add("Address", customer.Address); // PageState.Add("Tel", customer.Tel); PageState.Add("Code", customer.Code); } } //根据压缩机唯一Id获取压缩机条码 else if (RequestActionString == "getprobyguid") { //string isbn = DataHelper.QueryValue("select ModelNo from " + db + "..Compressor where SeriesNo='" + RequestData.Get<string>("isbn") + "'") + ""; string isbn = DataHelper.QueryValue("select ModelNo from " + db + "..v_Compressor where SeriesNo='" + RequestData.Get <string>("Guid") + "' and ([State] is null or [State]<>'已出库')") + ""; PageState.Add("isbn", isbn); } //获取压缩机整版的数量及GUIDS else if (RequestActionString == "getprobyboxnum") { string boxnum = RequestData.Get <string>("boxnum"); string isbn = DataHelper.QueryValue("select ModelNo from " + db + "..v_Compressor where SkinNo='" + boxnum + "' and ([State] is null or [State]<>'已出库')") + ""; string count = DataHelper.QueryValue("select count(1) from " + db + "..v_Compressor where SkinNo='" + boxnum + "' and ([State] is null or [State]<>'已出库')") + ""; string guids = DataHelper.QueryValue("select " + db + ".dbo.fun_getGuids('" + boxnum + "')") + ""; PageState.Add("isbn", isbn); PageState.Add("count", count); PageState.Add("guids", guids); } //获取配件箱子所包含的配件数量 else if (RequestActionString == "getPJbyboxnum") { string boxnum = RequestData.Get <string>("boxnum"); sql = "select * from SHHG_AimExamine..Products where FirstSkinIsbn='" + boxnum + "' and FirstSkinCapacity is not null"; IList <EasyDictionary> dics = DataHelper.QueryDictList(sql); if (dics.Count > 0) { PageState.Add("isbn", dics[0].Get <string>("Isbn")); PageState.Add("count", dics[0].Get <int>("FirstSkinCapacity")); } sql = "select * from SHHG_AimExamine..Products where SecondSkinIsbn='" + boxnum + "' and SecondSkinCapacity is not null"; dics = DataHelper.QueryDictList(sql); if (dics.Count > 0) { PageState.Add("isbn", dics[0].Get <string>("Isbn")); PageState.Add("count", dics[0].Get <int>("SecondSkinCapacity")); } } else if (RequestActionString == "getguids") { string guids = DataHelper.QueryValue("select " + db + ".dbo.fun_getGuids('" + RequestData.Get <string>("SkinNo") + "'," + RequestData.Get <string>("Count") + ")") + ""; PageState.Add("guids", guids); } else if (op != "c" && op != "cs") { if (!String.IsNullOrEmpty(id)) { ent = DeliveryOrder.Find(id); } SetFormData(ent); PageState.Add("State", ent.State); //查询子商品 sql = "select p.Id, PId, PCode as Code, ProductId, PName as Name, c.ProductType, p.Isbn, Guids, Count,Count-(isnull(OutCount,0)) as dck, isnull(OutCount,0) as OutCount, p.Unit, p.Remark, FirstSkinIsbn,Count*(c.Weight) as TotalWeight," + db + ".dbo.fun_getProQuantity(ProductId) as StockQuan," + db + ".dbo.fun_getProQuantityByWarehouseId(ProductId,'" + ent.WarehouseId + "') as BenStockQuan from " + db + "..DelieryOrderPart p " + " left join " + db + "..Products c on c.Id=p.ProductId where DId='" + id + "'"; PageState.Add("DetailList", DataHelper.QueryDictList(sql)); } PageState.Add("DeliveryMode", SysEnumeration.GetEnumDict("DeliveryMode")); }