Exemple #1
0
 public static int InsertData(Paper_Out po)
 {
     if (po != null)
     {
         return(DataSource.ORMHelper.InsertModel <Paper_Out>(po));
     }
     return(0);
 }
Exemple #2
0
        public static List <Paper_Out> TransMaterListToOutList(List <P_Order> allorder)
        {
            List <Paper_Out>   Plist  = new List <Paper_Out>();
            List <Paper_Store> Papers = Paper_Store.GetAllPaperList();

            List <P_MaterialList2> M2List;
            string orderlist = "";

            foreach (P_Order order in allorder)
            {
                string oderno = order.OrderOn;
                oderno     = oderno.Replace("O", "PUB");
                oderno     = "'" + oderno + "',";
                orderlist += oderno;
                //List<P_MaterialList2> mlist = P_MaterialList2.GetDataList("OrderOn='" + oderno + "'");
            }
            orderlist = orderlist.Remove(orderlist.Length - 1, 1);
            M2List    = P_MaterialList2.GetDataList("OrderOn in (" + orderlist + ") and Status=0");
            foreach (P_Order order in allorder)
            {
                string oderno = order.OrderOn;
                oderno = oderno.Replace("O", "PUB");
                List <P_MaterialList2> mlist = new List <P_MaterialList2>();
                for (int j = 0; j < M2List.Count; j++)
                {
                    if (M2List[j].OrderOn == oderno)
                    {
                        mlist.Add(M2List[j]);
                    }
                }
                // List<P_MaterialList2> mlist = P_MaterialList2.GetDataList("OrderOn='" + oderno + "'");
                if (mlist != null)
                {
                    for (int i = 0; i < mlist.Count; i++)
                    {
                        Paper_Out po = new Paper_Out();
                        po.OrderNo  = order.OrderOn;
                        po.OutTime  = order.OrderTime;
                        po.Remark   = order.Receiver;
                        po.RealTime = DateTime.Now;
                        po.b1       = order.b2;

                        po.Num     = mlist[i].Num + mlist[i].ExtendNum;
                        po.PaperId = mlist[i].b1;
                        Paper_Store ps = null;
                        foreach (Paper_Store p1 in Papers)
                        {
                            if (p1.PaperId == po.PaperId)
                            {
                                ps = p1;
                                break;
                            }
                        }
                        if (ps != null)
                        {
                            po.PaperName  = mlist[i].b2;
                            po.Price      = ps.TaxiPrice;
                            po.Money      = po.Num * po.Price;
                            po.Money      = Math.Round(po.Money, 2);
                            po.SourceCode = OutStoreCode.生产出库.ToString();
                            po.Active     = true;
                            po.b2         = mlist[i].Id;
                            Plist.Add(po);
                        }
                    }
                }
            }
            if (Plist.Count > 0)
            {
                return(Plist);
            }
            else
            {
                return(null);
            }
        }
Exemple #3
0
 public static int Update(Paper_Out paperout)
 {
     return(DataSource.ORMHelper.UpdateModelById <Paper_Out>(paperout));
 }
Exemple #4
0
        public static DataTable MakeNewStore(int year, int month)
        {
            List <Store_month> StoreList = new List <Store_month>();
            List <Paper_Store> PaperList = Paper_Store.GetAllPaperList();

            List <Paper_In>  InList  = Paper_In.GetYearMonthList(year, month);
            List <Paper_Out> OutList = Paper_Out.GetYearMonthList(year, month);

            List <Store_month> Lastlist;

            Store_month total = new Store_month();

            if (month == 1)
            {
                Lastlist = GetMonthStoreList(year - 1, 12);
            }
            else
            {
                Lastlist = GetMonthStoreList(year, month - 1);
            }
            for (int i = 0; i < PaperList.Count; i++)
            {
                Store_month st = new Store_month();
                st.PaperId   = PaperList[i].PaperId;
                st.PaperName = PaperList[i].PaperName;
                int index = -1;
                if (InList != null)
                {
                    for (int j = 0; j < InList.Count; j++)
                    {
                        if (InList[j].PaperId == PaperList[i].PaperId)
                        {
                            index       = j;
                            st.InNum   += InList[index].Num;
                            st.InMoney += InList[index].Money;
                        }
                    }
                }
                if (OutList != null)
                {
                    for (int j = 0; j < OutList.Count; j++)
                    {
                        if (OutList[j].PaperId == PaperList[i].PaperId)
                        {
                            index        = j;
                            st.OutNum   += OutList[index].Num;
                            st.OutMoney += OutList[index].Money;
                        }
                    }
                }
                if (Lastlist != null)
                {
                    for (int j = 0; j < Lastlist.Count; j++)
                    {
                        if (Lastlist[j].PaperId == PaperList[i].PaperId)
                        {
                            index        = j;
                            st.LastNum   = Lastlist[index].CurrentNum;
                            st.LastMoney = Lastlist[index].CurrentMoney;
                        }
                    }
                }
                st.Year         = year;
                st.Month        = month;
                st.OrderNo      = year * 100 + month;
                st.CalTime      = DateTime.Now;
                st.CurrentNum   = PaperList[i].Num;
                st.CurrentPrice = PaperList[i].TaxiPrice;
                st.CurrentMoney = PaperList[i].TaxiMoney;
                StoreList.Add(st);
                total.LastNum      += st.LastNum;
                total.LastMoney    += st.LastMoney;
                total.InNum        += st.InNum;
                total.InMoney      += st.InMoney;
                total.OutNum       += st.OutNum;
                total.OutMoney     += st.OutMoney;
                total.CurrentNum   += st.CurrentNum;
                total.CurrentMoney += st.CurrentMoney;
            }
            total.PaperName = "汇总";
            StoreList.Add(total);
            return(DataSource.ORMHelper.ModelListToTb <Store_month>(StoreList));
        }