/// <summary> /// 出库 /// </summary> /// <param name="da"></param> /// <param name="state"></param> /// <returns></returns> public bool signOfStorage(DataTable da, string orderType, string personNum) { if (da != null && da.Rows.Count > 0) { ArrayList SQLString = new ArrayList(); StringBuilder strSql = new StringBuilder(); SmartDeviceProjectEntity.HDTBAR _model = new SmartDeviceProjectEntity.HDTBAR(); //13 样品 14 返工类别 --其它出库 if (orderType == "13" || orderType == "14") { SmartDeviceProjectEntity.JSKLIA _modelTre = new SmartDeviceProjectEntity.JSKLIA(); SmartDeviceProjectEntity.JSKLIB _modelFor = new SmartDeviceProjectEntity.JSKLIB(); LIALIB(da, SQLString, strSql, _modelTre, _modelFor, personNum, orderType, _model); } //15 销货 else if (orderType == "15") { SmartDeviceProjectEntity.JSKKEA _modelOne = new SmartDeviceProjectEntity.JSKKEA(); SmartDeviceProjectEntity.JSKKEB _modelTwo = new SmartDeviceProjectEntity.JSKKEB(); KEAKEB(da, SQLString, strSql, _modelOne, _modelTwo, personNum, orderType, _model); } else { return(false); } return(SqlHelper.ExecuteSqlTran(SQLString)); } else { return(false); } }
/// <summary> /// 增加记录到JSKLIB /// </summary> /// <param name="_modelFor"></param> /// <param name="strSql"></param> /// <returns></returns> string IsertJSKLIB(SmartDeviceProjectEntity.JSKLIB _modelFor, StringBuilder strSql) { strSql = new StringBuilder(); strSql.Append("INSERT INTO JSKLIB("); strSql.Append("LIB001,LIB002,LIB003,LIB004,LIB005,LIB006,LIB007,LIB008,LIB011,LIB019,LIB020,LIB021,LIB022,LIB023,LIB024,LIB960,LIB961,LIB980)"); strSql.Append(" VALUES ("); strSql.AppendFormat("'{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}')", _modelFor.LIB001, _modelFor.LIB002, _modelFor.LIB003, _modelFor.LIB004, _modelFor.LIB005, _modelFor.LIB006, _modelFor.LIB007, _modelFor.LIB008, _modelFor.LIB011, _modelFor.LIB019, _modelFor.LIB020, _modelFor.LIB021, _modelFor.LIB022, _modelFor.LIB023, _modelFor.LIB024, _modelFor.LIB960, _modelFor.LIB961, _modelFor.LIB980); return(strSql.ToString()); }
void LIALIB(DataTable dt, ArrayList SQLString, StringBuilder strSql, SmartDeviceProjectEntity.JSKLIA _modelTre, SmartDeviceProjectEntity.JSKLIB _modelFor, string personNum, string orderType, SmartDeviceProjectEntity.HDTBAR _model) { SQLString.Clear(); _modelTre.LIA001 = _model.BAR010 = storageOfOddNumJSKLIA(); _modelTre.LIA002 = "条码"; _modelTre.LIA003 = DateTime.Now.ToString("yyyyMMdd"); _modelTre.LIA004 = orderType; _modelTre.LIA005 = personNum; _modelTre.LIA012 = "F"; DataTable da = GetDataTableJSKLIA(personNum); if (da != null && da.Rows.Count > 0) { _modelTre.LIA016 = da.Rows[0]["DBA005"].ToString(); } else { _modelTre.LIA016 = string.Empty; } SQLString.Add(IsertJSKLIA(_modelTre, strSql)); _modelFor.LIB001 = _modelTre.LIA001; List <string> strList = new List <string>(); for (int i = 0; i < dt.Rows.Count; i++) { _model.BAR009 = dt.Rows[i]["IBB001"].ToString(); _model.BAR008 = dt.Rows[i]["BAR008"].ToString(); _model.BAR020 = string.IsNullOrEmpty(dt.Rows[i]["BAR020"].ToString()) == true ? 0 : Convert.ToInt32(dt.Rows[i]["BAR020"].ToString()); _model.BAR020 += getCkNum(_model.BAR008); SQLString.Add(EditHDTBAR(strSql, _model)); } string[] fileNames = { "BAR001", "BAR007" }; DataTable ds = distinct(dt, fileNames); for (int k = 0; k < ds.Rows.Count; k++) { _modelFor.LIB003 = ds.Rows[k]["BAR001"].ToString(); //if (!string.IsNullOrEmpty(dt.Select("BAR001='" + _modelFor.LIB003 + "'").Length.ToString())) // _modelFor.LIB008 = dt.Select("BAR001='" + _modelFor.LIB003 + "'").Length; //else // _modelFor.LIB008 = 0; _modelFor.LIB008 = string.IsNullOrEmpty(dt.Rows[k]["BAR020"].ToString()) == true ? 0 : Convert.ToInt32(dt.Rows[k]["BAR020"].ToString()); if (strList.Count < 1) { _modelFor.LIB002 = "001"; } else { _modelFor.LIB002 = maxStrList(strList).ToString(); if (Convert.ToInt32(_modelFor.LIB002) < 9) { _modelFor.LIB002 = "00" + (Convert.ToInt32(_modelFor.LIB002) + 1).ToString(); } else if (Convert.ToInt32(_modelFor.LIB002) >= 9 && Convert.ToInt32(_modelFor.LIB002) < 99) { _modelFor.LIB002 = "0" + (Convert.ToInt32(_modelFor.LIB002) + 1).ToString(); } else { _modelFor.LIB002 = (Convert.ToInt32(_modelFor.LIB002) + 1).ToString(); } } strList.Add(_modelFor.LIB002); DataTable de = GetDataTableJSKLIB(_modelFor.LIB003); if (de != null && de.Rows.Count > 0) { _modelFor.LIB004 = de.Rows[0]["DEA002"].ToString(); _modelFor.LIB005 = de.Rows[0]["DEA003"].ToString(); _modelFor.LIB006 = de.Rows[0]["DEA008"].ToString(); _modelFor.LIB024 = de.Rows[0]["DEA057"].ToString(); _modelFor.LIB960 = de.Rows[0]["BAR007"].ToString(); _modelFor.LIB980 = Math.Round(acreage(de.Rows[0]["DEA057"].ToString()) * _modelFor.LIB008, 2); _modelFor.LIB961 = de.Rows[0]["DEA961"].ToString(); _modelFor.LIB019 = de.Rows[0]["BAR007"].ToString(); //_modelFor.LIB008 = string.IsNullOrEmpty(de.Rows[0]["COUN"].ToString()) == true ? 0 : Convert.ToInt32(de.Rows[0]["COUN"].ToString()); } else { _modelFor.LIB004 = string.Empty; _modelFor.LIB005 = string.Empty; _modelFor.LIB006 = string.Empty; _modelFor.LIB024 = string.Empty; _modelFor.LIB960 = string.Empty; _modelFor.LIB980 = 0; _modelFor.LIB961 = string.Empty; _modelFor.LIB019 = string.Empty; //_modelFor.LIB008 = 0; } _modelFor.LIB007 = -1; _modelFor.LIB011 = "F"; _modelFor.LIB020 = 1; _modelFor.LIB021 = 1; _modelFor.LIB022 = _modelFor.LIB005; _modelFor.LIB023 = _modelFor.LIB008; SQLString.Add(IsertJSKLIB(_modelFor, strSql)); } }