コード例 #1
0
ファイル: BillDal.cs プロジェクト: SaintLoong/PFK
        public void AddBill(DataRow masterRow, DataTable detailTable, Dictionary<string, DataTable> productState, string prefix, string billDate)
        {
            using (PersistentManager pm = new PersistentManager())
            {
                try
                {
                    BillDao billDao = new BillDao();
                    ProductStateDao stateDao = new ProductStateDao();
                    ScheduleDao scheduleDao = new ScheduleDao();

                    pm.BeginTransaction();
                    string billNo = billDao.FindNewBillNo(prefix, billDate);

                    masterRow["BILLNO"] = billNo;
                    //���뵥������
                    billDao.InsertMaster(masterRow);

                    //���뵥����ϸ��
                    billDao.InsertDetail(billNo, detailTable);

                    if (productState != null)
                    {
                        //����ProductState��
                        int itemNo = 1;
                        foreach (DataTable stateTable in productState.Values)
                        {
                            stateDao.Insert(masterRow["SCHEDULENO"].ToString(),
                                        billNo,
                                        stateTable,
                                        ref itemNo);
                        }
                    }
                    pm.Commit();
                }
                catch (Exception e)
                {
                    pm.Rollback();
                    throw new Exception(e.Message);
                }
            }
        }
コード例 #2
0
ファイル: ScheduleDal.cs プロジェクト: SaintLoong/PFK
        public string GenBill(string formulaCode, string scheduleNo, double quantity, String userID, string sysDate, string sysDate8)
        {
            string billNo = null;
            using (PersistentManager pm = new PersistentManager())
            {

                FormulaDao formulaDao = new FormulaDao();
                DataTable formulaTable = formulaDao.FindDetail(formulaCode);

                BillDao billDao = new BillDao();
                DataTable detailTable = billDao.FindDetailEmpty();

                int itemNo = 1;
                foreach (DataRow formulaRow in formulaTable.Rows)
                {
                    DataRow detailRow = detailTable.NewRow();

                    detailRow["ITEMNO"] = itemNo++;
                    detailRow["PRODUCTCODE"] = formulaRow["PRODUCTCODE"];
                    detailRow["QUANTITY"] = quantity * (Convert.ToDouble(formulaRow["QUANTITY"]) / 100.0);
                    detailRow["PACKAGECOUNT"] = 0;
                    detailRow["NCCOUNT"] = 0;
                    detailRow["OTHERCODE"] = formulaRow["OTHERCODE"];
                    detailTable.Rows.Add(detailRow);
                }
                try
                {
                    pm.BeginTransaction();

                    //string warehousePrefix = "C";
                    //billNo = warehousePrefix + sysDate8 + billDao.FindBillNo(sysDate, warehousePrefix).ToString().PadLeft(5, '0');
                    billNo = billDao.FindNewBillNo("C", sysDate);
                    billDao.InsertMaster(billNo, DateTime.Now.ToShortDateString(), "002", scheduleNo, scheduleNo, "", "", "1", "1", userID);
                    billDao.InsertDetail(billNo, detailTable);

                    ScheduleDao scheduleDao = new ScheduleDao();
                    scheduleDao.UpdateBillNo(scheduleNo, billNo);

                    pm.Commit();
                }
                catch (Exception e)
                {
                    pm.Rollback();
                    throw new Exception(e.Message);
                }
            }
            return billNo;
        }
コード例 #3
0
ファイル: BillDal.cs プロジェクト: SaintLoong/PFK
        public void SendBill(string oriBillNo, string sysDate, string userID, string status)
        {
            using (PersistentManager pm = new PersistentManager())
            {
                try
                {
                    BillDao billDao = new BillDao();
                    ProductStateDao stateDao = new ProductStateDao();

                    pm.BeginTransaction();

                    string billNo = billDao.FindNewBillNo("P", sysDate);

                    billDao.UpdateMasterState(oriBillNo, "5", "SENDER", userID, "SENDDATE", sysDate);
                    billDao.SendMaster(billNo, sysDate, oriBillNo, userID, status);

                    DataTable detailTable = stateDao.Find(oriBillNo);
                    billDao.InsertDetail(billNo, detailTable);

                    if (status == "1")//���ⵥ
                    {
                        billDao.InsertDetail("T" + billNo, detailTable);
                        stateDao.Send("T" + billNo, oriBillNo);
                    }

                    //DataTable cigaretteTable = stateDao.FindCigarette(oriBillNo);
                    //stateDao.UpdateCigarette(oriBillNo, cigaretteTable);

                    stateDao.UpdateBarcode2(oriBillNo);
                    stateDao.Send(billNo, oriBillNo);

                    pm.Commit();
                }
                catch (Exception e)
                {
                    pm.Rollback();
                    throw new Exception(e.Message);
                }
            }
        }
コード例 #4
0
ファイル: BillDal.cs プロジェクト: SaintLoong/PFK
        public string GenBillFromTask(string billNo, string billType, string userID, string sysDate)
        {
            string newNo = null;
            using (PersistentManager pm = new PersistentManager())
            {
                BillDao billDao = new BillDao();
                ProductStateDao stateDao = new ProductStateDao();

                try
                {
                    pm.BeginTransaction();
                    DataTable stateTable = stateDao.FindBillDetail(billNo);

                    DataTable masterTable = billDao.FindMaster(billNo);

                    if (masterTable.Rows.Count != 0)
                    {
                        DataRow masterRow = masterTable.Rows[0];

                        string target = "";
                        if (billType == "002")//���ɵĵ���Ϊ���ⵥ
                            target = "3";

                        newNo = billDao.FindNewBillNo("P", sysDate);
                        billDao.InsertMaster(newNo, sysDate, billType, masterRow["SCHEDULENO"].ToString(),
                                         masterRow["BILLNO"].ToString(), masterRow["WAREHOUSECODE"].ToString(),
                                         target, "0", "1", userID);
                        int itemNo = 1;
                        foreach (DataRow stateRow in stateTable.Rows)
                        {
                            if (stateRow["REALQUANTITY"].ToString().Trim().Length != 0)
                            {
                                stateRow["REALQUANTITY"] = 0;
                                stateDao.Insert(newNo, billType, itemNo++, stateRow);
                            }
                        }

                        if (itemNo == 1)
                            throw new Exception("û���̰��ѳ��⣬����Ҫ�����˿ⵥ");

                        DataTable detailTable = stateDao.Find(newNo);
                        billDao.InsertDetail(newNo, detailTable);
                    }

                    pm.Commit();
                }
                catch (Exception e)
                {
                    pm.Rollback();
                    throw new Exception(e.Message);
                }
            }
            return newNo;
        }