コード例 #1
0
ファイル: UpdateUploadBll.cs プロジェクト: tw0r2/wms_rfid
 /// <summary>
 /// 手动添加单据细表
 /// </summary>
 /// <param name="infoTableName"></param>
 /// <param name="id"></param>
 /// <param name="bill"></param>
 /// <param name="product"></param>
 /// <param name="quantity"></param>
 /// <param name="isUpdate"></param>
 /// <param name="queryTable"></param>
 public void InsertDetail(string infoTableName, string id, string bill, string product, decimal quantity, bool isUpdate, string billDetailTable)
 {
     using (PersistentManager persistentManager = new PersistentManager())
     {
         UpdateUploadDao dao = new UpdateUploadDao();
         dao.SetPersistentManager(persistentManager);
         DataTable productTable = dao.ProductRate(product);
         decimal   quan         = Convert.ToDecimal(quantity * Convert.ToInt32(productTable.Rows[0]["JIANRATE"].ToString()) / Convert.ToInt32(productTable.Rows[0]["TIAORATE"].ToString()));
         if (isUpdate)
         {
             Thread.Sleep(500);//确保数据已经添加
             //string sql = string.Format("SELECT ID FROM {2} WHERE PRODUCTCODE='{0}' AND BILLNO='{1}'", product, bill, billDetailTable);
             //string stokeId = dao.GetDate(sql).ToString();
             DataTable table  = dao.QueryBusiBill(infoTableName);
             DataRow   newRow = table.NewRow();
             newRow["STORE_BILL_DETAIL_ID"] = id;
             newRow["STORE_BILL_ID"]        = bill.ToString().Trim();
             newRow["BRAND_CODE"]           = product;
             newRow["BRAND_NAME"]           = this.QueryProduceName(product).ToString();
             newRow["QUANTITY"]             = quan;
             newRow["IS_IMPORT"]            = "0";
             newRow["BILL_TYPE"]            = "1001";
             table.Rows.Add(newRow);
             dao.InsertMaster(infoTableName, table);
         }
         else
         {
             string productname = this.QueryProduceName(product).ToString();
             string sql         = string.Format("UPDATE {0} SET STORE_BILL_ID='{1}',BRAND_CODE='{2}',BRAND_NAME='{3}',QUANTITY='{4}' WHERE STORE_BILL_DETAIL_ID='{5}'",
                                                infoTableName, bill, product, productname, Convert.ToDecimal(quan), id.ToString());
             dao.UpdateTable(sql);
         }
     }
 }
コード例 #2
0
ファイル: UpdateUploadBll.cs プロジェクト: tw0r2/wms_rfid
 /// <summary>
 /// 手动添加单据主表
 /// </summary>
 /// <param name="infoTableName"></param>
 /// <param name="bill"></param>
 /// <param name="type"></param>
 /// <param name="state"></param>
 /// <param name="operate"></param>
 /// <param name="isUpdate"></param>
 public void InsertBillMaster(string infoTableName, string bill, string type, string state, string operate, bool isUpdate)
 {
     using (PersistentManager persistentManager = new PersistentManager())
     {
         UpdateUploadDao dao = new UpdateUploadDao();
         dao.SetPersistentManager(persistentManager);
         if (isUpdate)
         {
             DataTable table  = dao.QueryBusiBill(infoTableName);
             DataRow   newRow = table.NewRow();
             newRow["STORE_BILL_ID"] = bill.ToString().Trim();
             newRow["DIST_CTR_CODE"] = dao.GetCompany().ToString();
             newRow["AREA_TYPE"]     = "0901";
             newRow["CREATOR_CODE"]  = operate;
             newRow["CREATE_DATE"]   = DateTime.Now.ToString("yyyyMMddHHmmss");
             newRow["IN_OUT_TYPE"]   = "1202";
             newRow["BILL_TYPE"]     = type;
             newRow["BILL_STATUS"]   = state;
             newRow["DISUSE_STATUS"] = "0";
             newRow["IS_IMPORT"]     = "0";
             table.Rows.Add(newRow);
             dao.InsertMaster(infoTableName, table);
         }
         else
         {
             string sql = string.Format("UPDATE {0} SET CREATE_DATE='{2}',BILL_TYPE='{3}',BILL_STATUS='{4}' WHERE STORE_BILL_ID='{5}'",
                                        infoTableName, operate, DateTime.Now.ToString("yyyyMMddHHmmss"), type, state, bill);
             dao.UpdateTable(sql);
         }
     }
 }