Exemplo n.º 1
0
 public static int Update(P_MaterialList2 pm2)
 {
     return(DataSource.ORMHelper.UpdateModelById <P_MaterialList2>(pm2));
 }
Exemplo n.º 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);
            }
        }