Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            switch (RequestActionString)
            {
            case "Judge":
                string id = RequestData.Get <string>("id");
                if (!string.IsNullOrEmpty(id))
                {
                    InWarehouse       iwEnt = InWarehouse.Find(id);
                    WarehouseExchange weEnt = WarehouseExchange.Find(iwEnt.PublicInterface);
                    if (weEnt.OutWarehouseState == "已出库")
                    {
                        PageState.Add("Allow", true);
                    }
                    else
                    {
                        PageState.Add("Allow", false);
                    }
                }
                break;

            default:
                DoSelect();
                break;
            }
        }
Esempio n. 2
0
 private void ProcessDetail(IList <string> entStrList, WarehouseExchange weEnt)
 {
     if (entStrList != null && entStrList.Count > 0)
     {
         for (int j = 0; j < entStrList.Count; j++)
         {
             Newtonsoft.Json.Linq.JObject objL   = JsonHelper.GetObject <Newtonsoft.Json.Linq.JObject>(entStrList[j]);
             WarehouseExchangeDetail      wedEnt = new WarehouseExchangeDetail();
             wedEnt.WarehouseExchangeId = weEnt.Id;
             wedEnt.ProductId           = objL.Value <string>("ProductId");
             wedEnt.ProductName         = objL.Value <string>("ProductName");
             wedEnt.ProductCode         = objL.Value <string>("ProductCode");
             wedEnt.ProductPcn          = objL.Value <string>("ProductPcn");
             wedEnt.ProductIsbn         = objL.Value <string>("ProductIsbn");
             wedEnt.ExchangeQuantity    = objL.Value <int>("ExchangeQuantity");
             wedEnt.DoCreate();
         }
     }
 }
        string type = String.Empty; // 对象类型
        protected void Page_Load(object sender, EventArgs e)
        {
            op   = RequestData.Get <string>("op");
            id   = RequestData.Get <string>("id");
            type = RequestData.Get <string>("type");
            WarehouseExchange ent = null;

            switch (RequestActionString)
            {
            default:
                DoSelect();
                break;
            }
            if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    ent = WarehouseExchange.Find(id);
                    SetFormData(ent);
                }
            }
        }
Esempio n. 4
0
        private void ProcessInWarehouse(InWarehouse tempEnt)
        {
            if (tempEnt.InWarehouseType == "采购入库")
            {
                //判断其下所有的入库详细状态都未已入库 则自己的状态改为已入库
                IList <InWarehouseDetail> iwdEnts = InWarehouseDetail.FindAll("from InWarehouseDetail where InWarehouseState='未入库' and InWarehouseId='" + tempEnt.Id + "'");
                if (iwdEnts.Count == 0)
                {
                    tempEnt.State = "已入库";
                    tempEnt.InWarehouseEndTime = System.DateTime.Now;
                    tempEnt.CheckUserId        = UserInfo.UserID;
                    tempEnt.CheckUserName      = UserInfo.Name;
                    tempEnt.DoUpdate();
                }
            }
            else
            {
                IList <OtherInWarehouseDetail> oiwdEnts = OtherInWarehouseDetail.FindAll("from OtherInWarehouseDetail where InWarehouseState='未入库' and InWarehouseId='" + tempEnt.Id + "'");
                if (oiwdEnts.Count == 0)//如果明细都入库了
                {
                    //add by cc
                    string db = ConfigurationManager.AppSettings["ExamineDB"];
                    if (tempEnt.InWarehouseType == "退货入库")
                    {
                        ReturnOrder rtnOrder = ReturnOrder.TryFind(tempEnt.PublicInterface);
                        if (rtnOrder != null)
                        {
                            rtnOrder.State = "已完成";
                            rtnOrder.DoSave();
                            //判断是否已经全部退货
                            //string DeliveryState = "";
                            //string tempId = DataHelper.QueryValue<string>("select top 1 Id from " + db + "..Saleorders where number='" + rtnOrder.OrderNumber + "'");
                            //if (!string.IsNullOrEmpty(tempId))
                            //{
                            //    DeliveryState = DataHelper.QueryValue<string>("select " + db + ".dbo.fun_getDeliveryState('" + tempId + "')");
                            //}

                            ////更新SaleOrder表出库状态
                            //if (DeliveryState == "已全部退货")
                            //{
                            //    DataHelper.ExecSql("update " + db + "..SaleOrders set DeState='已全部退货',DeliveryState='已全部退货' where Number='" + rtnOrder.OrderNumber + "'");
                            //}
                            //else
                            //{
                            //    DataHelper.ExecSql("update " + db + "..SaleOrders set DeState='" + DeliveryState + "' where Number='" + rtnOrder.OrderNumber + "'");
                            //    //DataHelper.ExecSql("update " + db + "..SaleOrders set DeState=" + db + ".dbo.fun_getDeliveryState(Id) where Number='" + rtnOrder.OrderNumber + "'");
                            //}
                        }
                    }
                    //else if (tempEnt.InWarehouseType == "换货入库")
                    //{
                    //    ChangeProduct dorder = ChangeProduct.TryFind(tempEnt.PublicInterface);
                    //    if (dorder != null)
                    //    {
                    //        if ((dorder.State + "").Contains("已出库"))
                    //        {
                    //            dorder.State = "已完成";
                    //        }
                    //        else
                    //        {
                    //            dorder.State += ",仓库已入库:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm");
                    //        }
                    //        dorder.DoSave();

                    //        //更新SaleOrder表出库状态
                    //        DataHelper.ExecSql("update " + db + "..SaleOrders set DeState=" + db + ".dbo.fun_getDeliveryState(Id) where Number='" + dorder.OrderNumber + "'");
                    //    }
                    //}
                    //end add by cc
                    else if (tempEnt.InWarehouseType == "调拨入库")
                    {
                        WarehouseExchange weEnt = WarehouseExchange.TryFind(tempEnt.PublicInterface);
                        weEnt.InWarehouseState = "已入库";
                        weEnt.DoUpdate();
                        if (weEnt.OutWarehouseState == "已出库")
                        {
                            weEnt.ExchangeState = "已结束";
                            weEnt.EndTime       = System.DateTime.Now;
                            weEnt.DoUpdate();
                        }
                    }
                    tempEnt.State = "已入库";
                    tempEnt.InWarehouseEndTime = System.DateTime.Now;
                    tempEnt.CheckUserId        = UserInfo.UserID;
                    tempEnt.CheckUserName      = UserInfo.Name;
                    tempEnt.DoUpdate();
                }
            }
        }
Esempio n. 5
0
        string type = String.Empty; // 对象类型
        protected void Page_Load(object sender, EventArgs e)
        {
            op   = RequestData.Get <string>("op");
            id   = RequestData.Get <string>("id");
            type = RequestData.Get <string>("type");
            IList <string>    entStrList = RequestData.GetList <string>("data");
            WarehouseExchange ent        = null;

            switch (RequestActionString)
            {
            case "create":
                ent = GetPostedData <WarehouseExchange>();
                ent.ExchangeState     = "未结束";
                ent.OutWarehouseState = "未出库";
                ent.InWarehouseState  = "未入库";
                ent.CreateId          = UserInfo.UserID;
                ent.CreateName        = UserInfo.Name;
                ent.CreateTime        = System.DateTime.Now;
                ent.DoCreate();
                ProcessDetail(entStrList, ent);
                DeliveryOrder doEnt = new DeliveryOrder();
                doEnt.Number        = DataHelper.QueryValue("select SHHG_AimExamine.dbo.fun_getDeliveryNumber()").ToString();
                doEnt.DeliveryType  = "调拨出库";
                doEnt.PId           = ent.Id;
                doEnt.WarehouseId   = ent.FromWarehouseId;
                doEnt.WarehouseName = ent.FromWarehouseName;
                doEnt.DoCreate();
                ProcessDeliveryOrderDetail(entStrList, doEnt);
                InWarehouse iwEnt = new InWarehouse();
                iwEnt.WarehouseId     = ent.ToWarehouseId;
                iwEnt.WarehouseName   = ent.ToWarehouseName;
                iwEnt.InWarehouseNo   = DataHelper.QueryValue <string>("select SHHG_AimExamine.dbo.fun_getInWarehouseNo()");
                iwEnt.InWarehouseType = "调拨入库";
                iwEnt.State           = "未入库";
                iwEnt.CreateId        = UserInfo.UserID;
                iwEnt.CreateName      = UserInfo.Name;
                iwEnt.CreateTime      = System.DateTime.Now;
                iwEnt.PublicInterface = ent.Id;
                iwEnt.DoCreate();
                ProcessInWarehouseDetail(entStrList, iwEnt);
                break;

            //case "update":
            //    ent = this.GetMergedData<PurchaseOrder>();
            //    PurchaseOrderDetail.DeleteAll("PurchaseOrderId='" + ent.Id + "'");
            //    ProcessDetail(entStrList, ent);
            //    ent.PurchaseType = "生产商采购";
            //    ent.DoUpdate();
            //    break;
            case "batchdelete":
                DoBatchDelete();
                break;

            default:
                DoSelect();
                break;
            }
            if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    string sql = @"select A.*,B.SupplierName,B.MoneyType,B.Symbo from SHHG_AimExamine..PurchaseOrder as A 
                    left join SHHG_AimExamine..Supplier as B on A.SupplierId=B.Id where A.Id='" + id + "'";
                    IList <EasyDictionary> ents = DataHelper.QueryDictList(sql);
                    this.SetFormData(ents[0]);
                }
            }
            else//添加的时候找到默认供应商
            {
                IList <EasyDictionary> dics = DataHelper.QueryDictList("select Id as SupplierId,SupplierName,MoneyType from SHHG_AimExamine..Supplier where IsDefault='on'");
                if (dics.Count > 0)
                {
                    this.SetFormData(dics[0]);
                }
                //添加的时候自动生成采购单流水号
                PageState.Add("ExchangeNo", DataHelper.QueryValue("select  SHHG_AimExamine.dbo.fun_GetWarehouseExchangeNo()"));
            }
        }
        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"));
        }