//生成理货单 public HttpResponseBase CreateTallyList() { string json = String.Empty; Aseld m = new Aseld(); AseldMaster am = new AseldMaster(); StringBuilder sql = new StringBuilder(); List<AseldQuery> list = new List<AseldQuery>(); _iasdMgr = new AseldMgr(mySqlConnectionString); _aseldmasterMgr = new AseldMasterMgr(mySqlConnectionString); //string order_id = Request.Params["order_id"]; string deliver_id = Request.Params["deliver_id"]; string fre = Request.Params["type_id"]; int radioselect = Convert.ToInt32(Request.Params["radio"]); //string ticket = ""; if (deliver_id != "" && fre != "") { DateTime dt = DateTime.Now; string type_id = "N"; if (fre != "2" && fre == "92") { type_id = "F"; } string assg = type_id + dt.ToString("yyyyMMddHHmmss"); try { if (!string.IsNullOrEmpty(deliver_id)) { deliver_id = deliver_id.Substring(0, deliver_id.Length - 1).ToString(); DataTable selDT = _iasdMgr.SelOrderDetail(deliver_id, fre, radioselect); foreach (DataRow r in selDT.Rows) { m.ordd_id = Convert.ToInt32(r["detail_id"]); _iasdMgr.ConsoleAseldBeforeInsert(Convert.ToInt32(r["detail_id"])); //ticket = ticket + item.ticket_id.ToString() + ','; m.deliver_id = Convert.ToInt32(r["deliver_id"]); m.deliver_code = CreateDeliverCode(r["deliver_id"].ToString()); m.ord_id = Int32.Parse(r["order_id"].ToString());//order_id m.ordd_id = Int32.Parse(r["detail_id"].ToString());//od.detail_id m.cust_id = r["user_id"].ToString();//om.user_id m.hzd_ind = r["item_id"].ToString(); //od.item_id m.item_id = Convert.ToUInt32(r["item_id"]);//od.item_id m.assg_id = assg; m.prod_qty = Int32.Parse(r["buy_num"].ToString()); if (r["sel_loc"].ToString() == "YY999999") { m.sel_loc = null; } else { m.sel_loc = r["sel_loc"].ToString();// i.loc_id } m.curr_pal_no = int.Parse(r["order_id"].ToString() + "1");//om.order_id m.wust_id = "AVL"; m.description = Convert.ToString(r["description"]);//od.product_name m.prod_sz = r["prod_sz"].ToString();//od.product_spec_name m.cust_name = r["cust_name"].ToString();//om.delivery_name m.invc_id = int.Parse(r["order_id"].ToString());//om.order_id m.commodity_type = r["product_mode"].ToString();//2寄倉或者3調度 //if (m.commodity_type == "3") //{ // m.sel_loc = "ZZ999999"; //} if (Convert.ToInt32(r["item_mode"]) != 0 && Convert.ToInt32(r["parent_num"]) != 0) { m.out_qty = m.prod_qty * Int32.Parse(r["parent_num"].ToString()); m.ord_qty = m.out_qty; } else { m.out_qty = m.prod_qty; m.ord_qty = m.out_qty; } m.upc_id = r["upc_id"].ToString();//iu.upc_id m.create_user = (System.Web.HttpContext.Current.Session["caller"] as Caller).user_id; sql.Append(_iasdMgr.Insert(m));//add aseld sql } am.assg_id = assg; am.create_time = dt; am.create_user = (System.Web.HttpContext.Current.Session["caller"] as Caller).user_id; sql.AppendFormat(_aseldmasterMgr.Insert(am));//add aseld sql sql.AppendFormat(_iasdMgr.UpdTicker(deliver_id));//upd deliver_id int msg = _iasdMgr.InsertSql(sql.ToString()); if (msg > 0) { json = "{success:true,assg:'" + assg + "'}"; } else { json = "{success:false,msg:0}"; } } else { json = "{success:false,msg:0}"; } } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); json = "{success:false,msg:0}"; } } this.Response.Clear(); this.Response.Write(json.ToString()); this.Response.End(); return this.Response; }
public HttpResponseBase GETMarkTallyWD() { StringBuilder sb = new StringBuilder(); string json = String.Empty; AseldQuery m = new AseldQuery(); List<AseldQuery> list = new List<AseldQuery>(); _iasdMgr = new AseldMgr(mySqlConnectionString); int flag = 2; int try1 = 0; try { m.seld_id = Int32.Parse(Request.Params["seld_id"]);//aseld的流水號 m.commodity_type = Request.Params["commodity_type"];//獲取寄倉2和調度3 m.ord_qty = Int32.Parse(Request.Params["ord_qty"]);//需要訂貨數量 if (Int32.TryParse(Request.Params["act_pick_qty"], out try1)) { m.act_pick_qty = Int32.Parse(Request.Params["act_pick_qty"]); } else { m.act_pick_qty = 0; } m.item_id = uint.Parse(Request.Params["item_id"]); m.out_qty = Int32.Parse(Request.Params["out_qty"]) - m.act_pick_qty;//缺貨數量 m.act_pick_qty = m.ord_qty - m.out_qty; m.complete_dtim = DateTime.Now; m.assg_id = Request.Params["assg_id"]; m.ord_id = Int32.Parse(Request.Params["ord_id"]); m.ordd_id = int.Parse(Request.Params["ordd_id"]);//商品細項編號。操作iwms_record需要 m.change_user = (System.Web.HttpContext.Current.Session["caller"] as Caller).user_id; m.deliver_code = Request.Params["deliver_id"]; m.deliver_id = int.Parse(m.deliver_code.Substring(1, m.deliver_code.Length - 1).ToString()); if (m.out_qty == 0) {//揀完了,判斷缺貨數量是否為0 m.wust_id = "COM"; } else {//沒拿夠貨物 m.wust_id = "SKP"; } sb.Append(_iasdMgr.UpdAseld(m)); if (m.commodity_type == "2") { #region 寄倉--對庫存進行操作 Dictionary<string, string> dickuCun = new Dictionary<string, string>(); if (Int32.TryParse(Request.Params["act_pick_qty"], out try1)) { if (!string.IsNullOrEmpty(Request.Params["pickRowId"])) { string[] iinvd = Request.Params["pickRowId"].Split(','); string[] pick = Request.Params["pickInfo"].Split(','); for (int i = 0; i < iinvd.Length; i++) { if (!dickuCun.Keys.Contains(iinvd[i])) { dickuCun.Add(iinvd[i], pick[i]); } else { dickuCun[iinvd[i]] = pick[i]; } } } } if (!string.IsNullOrEmpty(_iasdMgr.updgry(m, dickuCun))) { sb.Append(_iasdMgr.updgry(m, dickuCun)); } if (!string.IsNullOrEmpty(sb.ToString())) { _iasdMgr.InsertSql(sb.ToString());//執行SQL語句裡面有事物處理 } int ord = 1; int cancel = 0; int ord_id = 0; #region 判斷項目狀態 if (_iasdMgr.SelCom(m) == 0) { ord = 0; ord_id = m.ord_id; //訂單揀貨完成,可以封箱 } if (_iasdMgr.SelComA(m) == 0) { flag = 0;//項目訂單揀貨完成 } if (ord == 0) {//有沒有臨時取消的商品 if (_iasdMgr.SelComC(m) > 0) { cancel = 1; ord_id = m.ord_id; } } #endregion json = "{success:true,qty:'" + m.out_qty + "',flag:'" + flag + "',ord:'" + ord + "',cancel:'" + cancel + "',ord_id:'" + ord_id + "'}";//返回json數據 //qty 該物品是否缺貨,如果為零揀貨完成,否則彈框提示缺貨數量。 //over:0表示該訂單已經揀貨完畢,如果qty為零則提示該訂單可以封箱,qty不為零則提示該訂單還缺物品的數量。不為零則不提示任何信息。 #endregion } else if (m.commodity_type == "3") { #region 調度--對庫存進行操作 m.change_user = int.Parse((Session["caller"] as Caller).user_id.ToString());//操作iwms_record 需要插入create_uaer_id。对aseld中的change_user未做任何改变 m.act_pick_qty = Int32.Parse(Request.Params["act_pick_qty"]);//下一步插入檢貨記錄表,每檢一次記錄一次,實際撿貨量以傳過來的值為標準 if (_iasdMgr.getTime(m).Rows.Count > 0) {//獲取到有效期控管商品的保質期 m.cde_dt_incr = int.Parse(_iasdMgr.getTime(m).Rows[0]["cde_dt_incr"].ToString()); m.cde_dt_shp = int.Parse(_iasdMgr.getTime(m).Rows[0]["cde_dt_shp"].ToString()); } if (!string.IsNullOrEmpty(Request.Params["cde_dt"])) {//獲取有效日期算出製造日期 m.cde_dt = DateTime.Parse(Request.Params["cde_dt"]); if (m.cde_dt_incr > 0) { m.made_dt = m.cde_dt.AddDays(-m.cde_dt_incr); } else { m.made_dt = DateTime.Now; } } else if (!string.IsNullOrEmpty(Request.Params["made_dt"])) {//獲取製造日期獲取有效日期 m.made_dt = DateTime.Parse(Request.Params["made_dt"]); if (m.cde_dt_incr > 0) { m.cde_dt = m.made_dt.AddDays(m.cde_dt_incr); } else { m.cde_dt = DateTime.Now; } } else {//不是有效期控管 m.made_dt = DateTime.Now; m.cde_dt = DateTime.Now; } if (m.act_pick_qty > 0) { sb.Append(_iasdMgr.AddIwsRecord(m)); } //m.act_pick_qty = m.ord_qty - m.out_qty; _iasdMgr.InsertSql(sb.ToString());//執行SQL語句裡面有事物處理 int result = _iasdMgr.DecisionBulkPicking(m, 3);//判斷調度是否檢完,是否檢夠,是否可以裝箱 json = "{success:true,msg:'" + result + "'" + "}";//返回json數據 #endregion } } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); json = "{success:false,msg:0}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }
// 變更數量--丟棄 public HttpResponseBase UpdProdqty() { Iinvd m = new Iinvd(); IinvdLog il = new IinvdLog(); _iinvd = new IinvdMgr(mySqlConnectionString); string jsonStr = String.Empty; StringBuilder sb = new StringBuilder(); _iasdMgr = new AseldMgr(mySqlConnectionString); try { il.nvd_id = Int32.Parse(Request.Params["row_id"].ToString()); il.change_num = Int32.Parse(Request.Params["change_num"].ToString()); il.from_num = Int32.Parse(Request.Params["from_num"].ToString()); il.create_user = (Session["caller"] as Caller).user_id; il.create_date = DateTime.Now; m.row_id = il.nvd_id; m.prod_qty = il.change_num + il.from_num; m.change_dtim = DateTime.Now; m.change_user = (Session["caller"] as Caller).user_id; if (m.prod_qty >= 0) { sb.Append(_iinvd.UpdProdqty(m)); sb.Append(_iinvd.InsertIinvdLog(il)); _iasdMgr.InsertSql(sb.ToString());//執行SQL語句裡面有事物處理 jsonStr = "{success:true,msg:0}"; } else { jsonStr = "{success:true,msg:1}"; } } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); jsonStr = "{success:false}"; } this.Response.Clear(); this.Response.Write(jsonStr.ToString()); this.Response.End(); return this.Response; }