/// <summary> /// 保存(传入事务处理) /// </summary> /// <param name="p_Entity"></param> /// <param name="p_BE"></param> /// <param name="sqlTrans"></param> public void RSave(FabricProcess p_Entity, BaseEntity[] p_BE, IDBTransAccess sqlTrans) { try { string sql = "DELETE FROM WO_FabricProcessDts WHERE MainID=" + p_Entity.ID.ToString(); sql += " AND ID NOT IN" + string.Format("({0})", GetIDExist(p_BE)); sqlTrans.ExecuteNonQuery(sql);//删除原单据里应该删除的明细数据,即数据库里有但是UI里已经删除的数据 for (int i = 0; i < p_BE.Length; i++) { FabricProcessDts entitydts = (FabricProcessDts)p_BE[i]; if (entitydts.ID != 0)//ID不为0说明数据库中已经存在 { this.RUpdate(entitydts, sqlTrans); } else { entitydts.MainID = p_Entity.ID; this.RAdd(entitydts, sqlTrans); } } } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
/// <summary> /// 删除 /// </summary> /// <param name="p_Entity">实体类</param> /// <returns>操作影响的记录行数</returns> public override int Delete(BaseEntity p_Entity) { try { FabricProcessDts MasterEntity = (FabricProcessDts)p_Entity; if (MasterEntity.ID == 0) { return(0); } //删除主表数据 string Sql = ""; Sql = "DELETE FROM WO_FabricProcessDts WHERE " + "ID=" + SysString.ToDBString(MasterEntity.ID); //执行 int AffectedRows = 0; if (!this.sqlTransFlag) { AffectedRows = this.ExecuteNonQuery(Sql); } else { AffectedRows = sqlTrans.ExecuteNonQuery(Sql); } return(AffectedRows); } catch (BaseException E) { throw new BaseException(E.Message, E); } catch (Exception E) { throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBDelete), E); } }
/// <summary> /// 获得实体 /// </summary> /// <returns></returns> private FabricProcessDts[] EntityDtsGet() { int index = GetDataCompleteNum(); FabricProcessDts[] entitydts = new FabricProcessDts[index]; index = 0; for (int i = 0; i < gridView1.RowCount; i++) { if (CheckDataCompleteDts(i)) { entitydts[index] = new FabricProcessDts(); entitydts[index].ID = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "ID")); entitydts[index].SelectByID(); entitydts[index].MainID = HTDataID; entitydts[index].Seq = i + 1; entitydts[index].ItemCode = SysConvert.ToString(gridView1.GetRowCellValue(i, "ItemCode")); entitydts[index].GoodsCode = SysConvert.ToString(gridView1.GetRowCellValue(i, "GoodsCode")); entitydts[index].ColorNum = SysConvert.ToString(gridView1.GetRowCellValue(i, "ColorNum")); entitydts[index].ColorName = SysConvert.ToString(gridView1.GetRowCellValue(i, "ColorName")); entitydts[index].MWidth = SysConvert.ToString(gridView1.GetRowCellValue(i, "MWidth")); entitydts[index].MWeight = SysConvert.ToString(gridView1.GetRowCellValue(i, "MWeight")); entitydts[index].WeightUnit = SysConvert.ToString(gridView1.GetRowCellValue(i, "WeightUnit")); entitydts[index].ItemName = SysConvert.ToString(gridView1.GetRowCellValue(i, "ItemName")); entitydts[index].ItemModel = SysConvert.ToString(gridView1.GetRowCellValue(i, "ItemModel")); entitydts[index].ItemStd = SysConvert.ToString(gridView1.GetRowCellValue(i, "ItemStd")); entitydts[index].VColorNum = SysConvert.ToString(gridView1.GetRowCellValue(i, "VColorNum")); entitydts[index].VColorName = SysConvert.ToString(gridView1.GetRowCellValue(i, "VColorName")); entitydts[index].VItemCode = SysConvert.ToString(gridView1.GetRowCellValue(i, "VItemCode")); entitydts[index].Qty = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "Qty")); entitydts[index].Unit = SysConvert.ToString(gridView1.GetRowCellValue(i, "Unit")); entitydts[index].SingPrice = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "SingPrice")); entitydts[index].Amount = entitydts[index].Qty * entitydts[index].SingPrice; //entitydts[index].ReceivedDate = SysConvert.ToDateTime(gridView1.GetRowCellValue(i, "ReceivedDate")); //entitydts[index].ReceivedQty = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "ReceivedQty")); //entitydts[index].TotalRecQty = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "TotalRecQty")); //entitydts[index].RemainQty = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "RemainQty")); //entitydts[index].RemainRate = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "RemainRate")); //entitydts[index].OrderPreStatusID = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "OrderPreStatusID")); //entitydts[index].OrderStatusID = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "OrderStatusID")); entitydts[index].DVendorID = SysConvert.ToString(gridView1.GetRowCellValue(i, "DVendorID")); entitydts[index].DtsSO = SysConvert.ToString(gridView1.GetRowCellValue(i, "DtsSO")); entitydts[index].StyleNo = SysConvert.ToString(gridView1.GetRowCellValue(i, "StyleNo")); //款号 entitydts[index].PieceQty = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "PieceQty")); entitydts[index].FreeStr1 = SysConvert.ToString(gridView1.GetRowCellValue(i, "FreeStr1")); entitydts[index].FreeStr2 = SysConvert.ToString(gridView1.GetRowCellValue(i, "FreeStr2")); entitydts[index].FreeStr3 = SysConvert.ToString(gridView1.GetRowCellValue(i, "FreeStr3")); entitydts[index].FreeStr4 = SysConvert.ToString(gridView1.GetRowCellValue(i, "FreeStr4")); entitydts[index].FreeStr5 = SysConvert.ToString(gridView1.GetRowCellValue(i, "FreeStr5")); entitydts[index].Needle = SysConvert.ToString(gridView1.GetRowCellValue(i, "Needle")); index++; } } return(entitydts); }
/// <summary> /// 新增(传入事务处理) /// </summary> /// <param name="p_BE">要新增的实体</param> /// <param name="sqlTrans">事务类</param> public void RAdd(BaseEntity p_BE, BaseEntity p_BEAdd, BaseEntity[] p_BE2, BaseEntity[] p_BE3, IDBTransAccess sqlTrans) { try { this.CheckCorrect(p_BE); FabricProcess entity = (FabricProcess)p_BE; FabricProcessCtl control = new FabricProcessCtl(sqlTrans); string sql = "SELECT FormNo FROM WO_FabricProcess WHERE FormNo=" + SysString.ToDBString(entity.FormNo); DataTable dt = sqlTrans.Fill(sql); if (dt.Rows.Count > 0) { throw new BaseException("单号已存在,请重新生成"); } entity.ID = (int)EntityIDTable.GetID((long)SysEntity.WO_FabricProcess, sqlTrans); control.AddNew(entity); FormNoControlRule fnrule = new FormNoControlRule(); fnrule.RAddSort("WO_FabricProcess", "FormNo", entity.ProcessTypeID, sqlTrans); FabricProcessAddRule ruleAdd = new FabricProcessAddRule(); FabricProcessAdd entityAdd = (FabricProcessAdd)p_BEAdd; entityAdd.ID = entity.ID; ruleAdd.RAdd(entityAdd, sqlTrans); for (int i = 0; i < p_BE2.Length; i++) { FabricProcessDtsRule rule = new FabricProcessDtsRule(); FabricProcessDts entityDts = (FabricProcessDts)p_BE2[i]; entityDts.MainID = entity.ID; entityDts.Seq = i + 1; rule.RAdd(entityDts, sqlTrans); } for (int i = 0; i < p_BE3.Length; i++) { FabricProcessPBDtsRule rule = new FabricProcessPBDtsRule(); FabricProcessPBDts entityDts = (FabricProcessPBDts)p_BE3[i]; entityDts.MainID = entity.ID; entityDts.Seq = i + 1; rule.RAdd(entityDts, sqlTrans); } } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
/// <summary> /// 获得数据库里没有被删除的ID(即数据库里有而且UI里也没有删除的数据) /// </summary> /// <param name="p_BE"></param> /// <returns></returns> private string GetIDExist(BaseEntity[] p_BE) { string outstr = "0"; for (int i = 0; i < p_BE.Length; i++) { FabricProcessDts entitydts = (FabricProcessDts)p_BE[i]; if (entitydts.ID != 0) { outstr += "," + entitydts.ID; } } return(outstr); }
/// <summary> /// 删除 /// </summary> /// <param name="p_BE">要删除的实体</param> /// <param name="sqlTrans">事务类</param> public void RDelete(BaseEntity p_BE, IDBTransAccess sqlTrans) { try { this.CheckCorrect(p_BE); FabricProcessDts entity = (FabricProcessDts)p_BE; FabricProcessDtsCtl control = new FabricProcessDtsCtl(sqlTrans); control.Delete(entity); } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
/// <summary> /// 新增(传入事务处理) /// </summary> /// <param name="p_BE">要新增的实体</param> /// <param name="sqlTrans">事务类</param> public void RAdd(BaseEntity p_BE, IDBTransAccess sqlTrans) { try { this.CheckCorrect(p_BE); FabricProcessDts entity = (FabricProcessDts)p_BE; FabricProcessDtsCtl control = new FabricProcessDtsCtl(sqlTrans); entity.ID = (int)EntityIDTable.GetID((long)SysEntity.WO_FabricProcessDts, sqlTrans); control.AddNew(entity); } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
/// <summary> /// 获得实体 /// </summary> /// <returns></returns> private FabricProcessDts[] EntityDtsGet() { int index = 0; for (int i = 0; i < gridView1.RowCount; i++) { if (SysConvert.ToString(gridView1.GetRowCellValue(i, "ItemCode")) != string.Empty) { index++; } } FabricProcessDts[] entitydts = new FabricProcessDts[index]; index = 0; for (int i = 0; i < gridView1.RowCount; i++) { if (SysConvert.ToString(gridView1.GetRowCellValue(i, "ItemCode")) != string.Empty) { entitydts[index] = new FabricProcessDts(); entitydts[index].ID = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "ID")); entitydts[index].SelectByID(); entitydts[index].MainID = HTID; entitydts[index].Seq = i + 1; entitydts[index].ItemCode = SysConvert.ToString(gridView1.GetRowCellValue(i, "ItemCode")); entitydts[index].GoodsCode = SysConvert.ToString(gridView1.GetRowCellValue(i, "GoodsCode")); entitydts[index].ColorNum = SysConvert.ToString(gridView1.GetRowCellValue(i, "ColorNum")); entitydts[index].ColorName = SysConvert.ToString(gridView1.GetRowCellValue(i, "ColorName")); entitydts[index].MWidth = SysConvert.ToString(gridView1.GetRowCellValue(i, "MWidth")); entitydts[index].MWeight = SysConvert.ToString(gridView1.GetRowCellValue(i, "MWeight")); entitydts[index].WeightUnit = SysConvert.ToString(gridView1.GetRowCellValue(i, "WeightUnit")); entitydts[index].ItemName = SysConvert.ToString(gridView1.GetRowCellValue(i, "ItemName")); entitydts[index].ItemModel = SysConvert.ToString(gridView1.GetRowCellValue(i, "ItemModel")); entitydts[index].ItemStd = SysConvert.ToString(gridView1.GetRowCellValue(i, "ItemStd")); entitydts[index].VColorNum = SysConvert.ToString(gridView1.GetRowCellValue(i, "VColorNum")); entitydts[index].VColorName = SysConvert.ToString(gridView1.GetRowCellValue(i, "VColorName")); entitydts[index].VItemCode = SysConvert.ToString(gridView1.GetRowCellValue(i, "VItemCode")); entitydts[index].Qty = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "Qty")); entitydts[index].Unit = SysConvert.ToString(gridView1.GetRowCellValue(i, "Unit")); entitydts[index].SingPrice = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "SingPrice")); entitydts[index].Amount = entitydts[index].Qty * entitydts[index].SingPrice; entitydts[index].DVendorID = SysConvert.ToString(gridView1.GetRowCellValue(i, "DVendorID")); entitydts[index].DtsSO = SysConvert.ToString(gridView1.GetRowCellValue(i, "DtsSO")); entitydts[index].CalNum = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "CalNum")); entitydts[index].CalUnit = SysConvert.ToString(gridView1.GetRowCellValue(i, "CalUnit")); entitydts[index].DtsRemark = SysConvert.ToString(gridView1.GetRowCellValue(i, "DtsRemark")); entitydts[index].DesignNo = SysConvert.ToString(gridView1.GetRowCellValue(i, "DesignNo")); entitydts[index].EditionOK = SysConvert.ToString(gridView1.GetRowCellValue(i, "EditionOK")); entitydts[index].PieceQty = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "PieceQty")); entitydts[index].FreeStr1 = SysConvert.ToString(gridView1.GetRowCellValue(i, "FreeStr1")); entitydts[index].FreeStr2 = SysConvert.ToString(gridView1.GetRowCellValue(i, "FreeStr2")); entitydts[index].FreeStr3 = SysConvert.ToString(gridView1.GetRowCellValue(i, "FreeStr3")); entitydts[index].FreeStr4 = SysConvert.ToString(gridView1.GetRowCellValue(i, "FreeStr4")); entitydts[index].FreeStr5 = SysConvert.ToString(gridView1.GetRowCellValue(i, "FreeStr5")); entitydts[index].CPItemCode = SysConvert.ToString(gridView1.GetRowCellValue(i, "CPItemCode")); entitydts[index].CPItemName = SysConvert.ToString(gridView1.GetRowCellValue(i, "CPItemName")); entitydts[index].CPItemStd = SysConvert.ToString(gridView1.GetRowCellValue(i, "CPItemStd")); entitydts[index].CPItemModel = SysConvert.ToString(gridView1.GetRowCellValue(i, "CPItemModel")); entitydts[index].SL = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "SL")); entitydts[index].PBWeight = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "PBWeight")); entitydts[index].Needle = SysConvert.ToString(gridView1.GetRowCellValue(i, "Needle")); index++; } } return(entitydts); }
/// <summary> /// 获得实体 /// </summary> /// <returns></returns> private FabricProcessDts[] EntityDtsGet() { int index = GetDataCompleteNum(); FabricProcessDts[] entitydts = new FabricProcessDts[index]; index = 0; for (int i = 0; i < gridView1.RowCount; i++) { if (CheckDataCompleteDts(i)) { entitydts[index] = new FabricProcessDts(); entitydts[index].ID = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "ID")); entitydts[index].SelectByID(); entitydts[index].MainID = HTDataID; entitydts[index].Seq = i + 1; entitydts[index].ItemCode = SysConvert.ToString(gridView1.GetRowCellValue(i, "ItemCode")); entitydts[index].GoodsCode = SysConvert.ToString(gridView1.GetRowCellValue(i, "GoodsCode")); entitydts[index].ColorNum = SysConvert.ToString(gridView1.GetRowCellValue(i, "ColorNum")); entitydts[index].ColorName = SysConvert.ToString(gridView1.GetRowCellValue(i, "ColorName")); entitydts[index].MWidth = SysConvert.ToString(gridView1.GetRowCellValue(i, "MWidth")); entitydts[index].MWeight = SysConvert.ToString(gridView1.GetRowCellValue(i, "MWeight")); entitydts[index].WeightUnit = SysConvert.ToString(gridView1.GetRowCellValue(i, "WeightUnit")); entitydts[index].ItemName = SysConvert.ToString(gridView1.GetRowCellValue(i, "ItemName")); entitydts[index].ItemModel = SysConvert.ToString(gridView1.GetRowCellValue(i, "ItemModel")); entitydts[index].ItemStd = SysConvert.ToString(gridView1.GetRowCellValue(i, "ItemStd")); entitydts[index].VColorNum = SysConvert.ToString(gridView1.GetRowCellValue(i, "VColorNum")); entitydts[index].VColorName = SysConvert.ToString(gridView1.GetRowCellValue(i, "VColorName")); entitydts[index].VItemCode = SysConvert.ToString(gridView1.GetRowCellValue(i, "VItemCode")); entitydts[index].Qty = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "Qty")); entitydts[index].Unit = SysConvert.ToString(gridView1.GetRowCellValue(i, "Unit")); entitydts[index].SingPrice = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "SingPrice")); entitydts[index].AddFee = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "AddFee")); entitydts[index].AddFee2 = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "AddFee2")); entitydts[index].AddFee3 = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "AddFee3")); entitydts[index].AddFee4 = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "AddFee4")); entitydts[index].AddFee5 = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "AddFee5")); entitydts[index].PUnit = SysConvert.ToString(gridView1.GetRowCellValue(i, "PUnit")); entitydts[index].Amount = (entitydts[index].Qty * entitydts[index].SingPrice) + entitydts[index].AddFee + entitydts[index].AddFee2 + entitydts[index].AddFee3 + entitydts[index].AddFee4 + entitydts[index].AddFee5; //entitydts[index].ReceivedDate = SysConvert.ToDateTime(gridView1.GetRowCellValue(i, "ReceivedDate")); //entitydts[index].ReceivedQty = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "ReceivedQty")); //entitydts[index].TotalRecQty = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "TotalRecQty")); //entitydts[index].RemainQty = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "RemainQty")); //entitydts[index].RemainRate = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "RemainRate")); //entitydts[index].OrderPreStatusID = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "OrderPreStatusID")); //entitydts[index].OrderStatusID = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "OrderStatusID")); entitydts[index].DVendorID = SysConvert.ToString(gridView1.GetRowCellValue(i, "DVendorID")); entitydts[index].DtsSO = SysConvert.ToString(gridView1.GetRowCellValue(i, "DtsSO")); entitydts[index].CalNum = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "CalNum")); entitydts[index].CalUnit = SysConvert.ToString(gridView1.GetRowCellValue(i, "CalUnit")); entitydts[index].DtsRemark = SysConvert.ToString(gridView1.GetRowCellValue(i, "DtsRemark")); entitydts[index].DesignNo = SysConvert.ToString(gridView1.GetRowCellValue(i, "DesignNo")); entitydts[index].EditionOK = SysConvert.ToString(gridView1.GetRowCellValue(i, "EditionOK")); entitydts[index].PieceQty = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "PieceQty")); entitydts[index].FreeStr1 = SysConvert.ToString(gridView1.GetRowCellValue(i, "FreeStr1")); entitydts[index].FreeStr2 = SysConvert.ToString(gridView1.GetRowCellValue(i, "FreeStr2")); entitydts[index].FreeStr3 = SysConvert.ToString(gridView1.GetRowCellValue(i, "FreeStr3")); entitydts[index].FreeStr4 = SysConvert.ToString(gridView1.GetRowCellValue(i, "FreeStr4")); entitydts[index].FreeStr5 = SysConvert.ToString(gridView1.GetRowCellValue(i, "FreeStr5")); entitydts[index].CPItemCode = SysConvert.ToString(gridView1.GetRowCellValue(i, "CPItemCode")); entitydts[index].CPItemName = SysConvert.ToString(gridView1.GetRowCellValue(i, "CPItemName")); entitydts[index].CPItemStd = SysConvert.ToString(gridView1.GetRowCellValue(i, "CPItemStd")); entitydts[index].CPItemModel = SysConvert.ToString(gridView1.GetRowCellValue(i, "CPItemModel")); entitydts[index].SL = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "SL")); entitydts[index].PBWeight = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "PBWeight")); entitydts[index].Needle = SysConvert.ToString(gridView1.GetRowCellValue(i, "Needle")); entitydts[index].DtsAfterFinish = SysConvert.ToString(gridView1.GetRowCellValue(i, "DtsAfterFinish")); entitydts[index].DtsPackMethod = SysConvert.ToString(gridView1.GetRowCellValue(i, "DtsPackMethod")); index++; } } return(entitydts); }
/// <summary> /// 检查将要操作的数据是否符合业务规则 /// </summary> /// <param name="p_BE"></param> private void CheckCorrect(BaseEntity p_BE) { FabricProcessDts entity = (FabricProcessDts)p_BE; }
/// <summary> /// 修改 /// </summary> /// <param name="p_Entity">实体类</param> /// <returns>操作影响的记录行数</returns> public override int Update(BaseEntity p_Entity) { try { FabricProcessDts MasterEntity = (FabricProcessDts)p_Entity; if (MasterEntity.ID == 0) { return(0); } //更新主表数据 StringBuilder UpdateBuilder = new StringBuilder(); UpdateBuilder.Append("UPDATE WO_FabricProcessDts SET "); UpdateBuilder.Append(" ID=" + SysString.ToDBString(MasterEntity.ID) + ","); UpdateBuilder.Append(" MainID=" + SysString.ToDBString(MasterEntity.MainID) + ","); UpdateBuilder.Append(" Seq=" + SysString.ToDBString(MasterEntity.Seq) + ","); UpdateBuilder.Append(" ItemCode=" + SysString.ToDBString(MasterEntity.ItemCode) + ","); UpdateBuilder.Append(" GoodsCode=" + SysString.ToDBString(MasterEntity.GoodsCode) + ","); UpdateBuilder.Append(" ColorNum=" + SysString.ToDBString(MasterEntity.ColorNum) + ","); UpdateBuilder.Append(" ColorName=" + SysString.ToDBString(MasterEntity.ColorName) + ","); UpdateBuilder.Append(" MWidth=" + SysString.ToDBString(MasterEntity.MWidth) + ","); UpdateBuilder.Append(" MWeight=" + SysString.ToDBString(MasterEntity.MWeight) + ","); UpdateBuilder.Append(" WeightUnit=" + SysString.ToDBString(MasterEntity.WeightUnit) + ","); UpdateBuilder.Append(" ItemName=" + SysString.ToDBString(MasterEntity.ItemName) + ","); UpdateBuilder.Append(" VColorNum=" + SysString.ToDBString(MasterEntity.VColorNum) + ","); UpdateBuilder.Append(" VColorName=" + SysString.ToDBString(MasterEntity.VColorName) + ","); UpdateBuilder.Append(" VItemCode=" + SysString.ToDBString(MasterEntity.VItemCode) + ","); if (MasterEntity.Qty != 0) { UpdateBuilder.Append(" Qty=" + SysString.ToDBString(MasterEntity.Qty) + ","); } else { UpdateBuilder.Append(" Qty=null,"); } UpdateBuilder.Append(" Unit=" + SysString.ToDBString(MasterEntity.Unit) + ","); if (MasterEntity.SingPrice != 0) { UpdateBuilder.Append(" SingPrice=" + SysString.ToDBString(MasterEntity.SingPrice) + ","); } else { UpdateBuilder.Append(" SingPrice=null,"); } if (MasterEntity.Amount != 0) { UpdateBuilder.Append(" Amount=" + SysString.ToDBString(MasterEntity.Amount) + ","); } else { UpdateBuilder.Append(" Amount=null,"); } if (MasterEntity.ReceivedDate != SystemConfiguration.DateTimeDefaultValue) { UpdateBuilder.Append(" ReceivedDate=" + SysString.ToDBString(MasterEntity.ReceivedDate.ToString("yyyy-MM-dd HH:mm:ss")) + ","); } else { UpdateBuilder.Append(" ReceivedDate=null,"); } if (MasterEntity.ReceivedQty != 0) { UpdateBuilder.Append(" ReceivedQty=" + SysString.ToDBString(MasterEntity.ReceivedQty) + ","); } else { UpdateBuilder.Append(" ReceivedQty=null,"); } if (MasterEntity.TotalRecQty != 0) { UpdateBuilder.Append(" TotalRecQty=" + SysString.ToDBString(MasterEntity.TotalRecQty) + ","); } else { UpdateBuilder.Append(" TotalRecQty=null,"); } if (MasterEntity.RemainQty != 0) { UpdateBuilder.Append(" RemainQty=" + SysString.ToDBString(MasterEntity.RemainQty) + ","); } else { UpdateBuilder.Append(" RemainQty=null,"); } if (MasterEntity.RemainRate != 0) { UpdateBuilder.Append(" RemainRate=" + SysString.ToDBString(MasterEntity.RemainRate) + ","); } else { UpdateBuilder.Append(" RemainRate=null,"); } if (MasterEntity.DtsReqDate != SystemConfiguration.DateTimeDefaultValue) { UpdateBuilder.Append(" DtsReqDate=" + SysString.ToDBString(MasterEntity.DtsReqDate.ToString("yyyy-MM-dd HH:mm:ss")) + ","); } else { UpdateBuilder.Append(" DtsReqDate=null,"); } UpdateBuilder.Append(" Remark=" + SysString.ToDBString(MasterEntity.Remark) + ","); UpdateBuilder.Append(" OrderPreStatusID=" + SysString.ToDBString(MasterEntity.OrderPreStatusID) + ","); UpdateBuilder.Append(" OrderStatusID=" + SysString.ToDBString(MasterEntity.OrderStatusID) + ","); UpdateBuilder.Append(" DtsSO=" + SysString.ToDBString(MasterEntity.DtsSO) + ","); UpdateBuilder.Append(" DVendorID=" + SysString.ToDBString(MasterEntity.DVendorID) + ","); if (MasterEntity.NLQty != 0) { UpdateBuilder.Append(" NLQty=" + SysString.ToDBString(MasterEntity.NLQty) + ","); } else { UpdateBuilder.Append(" NLQty=null,"); } if (MasterEntity.NLFormDate != SystemConfiguration.DateTimeDefaultValue) { UpdateBuilder.Append(" NLFormDate=" + SysString.ToDBString(MasterEntity.NLFormDate.ToString("yyyy-MM-dd HH:mm:ss")) + ","); } else { UpdateBuilder.Append(" NLFormDate=null,"); } if (MasterEntity.InQty != 0) { UpdateBuilder.Append(" InQty=" + SysString.ToDBString(MasterEntity.InQty) + ","); } else { UpdateBuilder.Append(" InQty=null,"); } if (MasterEntity.InFormDate != SystemConfiguration.DateTimeDefaultValue) { UpdateBuilder.Append(" InFormDate=" + SysString.ToDBString(MasterEntity.InFormDate.ToString("yyyy-MM-dd HH:mm:ss")) + ","); } else { UpdateBuilder.Append(" InFormDate=null,"); } if (MasterEntity.OutQty != 0) { UpdateBuilder.Append(" OutQty=" + SysString.ToDBString(MasterEntity.OutQty) + ","); } else { UpdateBuilder.Append(" OutQty=null,"); } if (MasterEntity.OutFormDate != SystemConfiguration.DateTimeDefaultValue) { UpdateBuilder.Append(" OutFormDate=" + SysString.ToDBString(MasterEntity.OutFormDate.ToString("yyyy-MM-dd HH:mm:ss")) + ","); } else { UpdateBuilder.Append(" OutFormDate=null,"); } if (MasterEntity.PieceQty != 0) { UpdateBuilder.Append(" PieceQty=" + SysString.ToDBString(MasterEntity.PieceQty) + ","); } else { UpdateBuilder.Append(" PieceQty=null,"); } UpdateBuilder.Append(" ItemStd=" + SysString.ToDBString(MasterEntity.ItemStd) + ","); UpdateBuilder.Append(" ItemModel=" + SysString.ToDBString(MasterEntity.ItemModel) + ","); UpdateBuilder.Append(" GreyFabItemCode=" + SysString.ToDBString(MasterEntity.GreyFabItemCode) + ","); if (MasterEntity.CalNum != 0) { UpdateBuilder.Append(" CalNum=" + SysString.ToDBString(MasterEntity.CalNum) + ","); } else { UpdateBuilder.Append(" CalNum=null,"); } UpdateBuilder.Append(" CalUnit=" + SysString.ToDBString(MasterEntity.CalUnit) + ","); UpdateBuilder.Append(" DtsRemark=" + SysString.ToDBString(MasterEntity.DtsRemark) + ","); UpdateBuilder.Append(" DesignNo=" + SysString.ToDBString(MasterEntity.DesignNo) + ","); UpdateBuilder.Append(" EditionOK=" + SysString.ToDBString(MasterEntity.EditionOK) + ","); UpdateBuilder.Append(" FreeStr1=" + SysString.ToDBString(MasterEntity.FreeStr1) + ","); UpdateBuilder.Append(" FreeStr2=" + SysString.ToDBString(MasterEntity.FreeStr2) + ","); UpdateBuilder.Append(" FreeStr3=" + SysString.ToDBString(MasterEntity.FreeStr3) + ","); UpdateBuilder.Append(" FreeStr4=" + SysString.ToDBString(MasterEntity.FreeStr4) + ","); UpdateBuilder.Append(" FreeStr5=" + SysString.ToDBString(MasterEntity.FreeStr5) + ","); if (MasterEntity.SL != 0) { UpdateBuilder.Append(" SL=" + SysString.ToDBString(MasterEntity.SL) + ","); } else { UpdateBuilder.Append(" SL=null,"); } if (MasterEntity.PBWeight != 0) { UpdateBuilder.Append(" PBWeight=" + SysString.ToDBString(MasterEntity.PBWeight) + ","); } else { UpdateBuilder.Append(" PBWeight=null,"); } UpdateBuilder.Append(" CPItemCode=" + SysString.ToDBString(MasterEntity.CPItemCode) + ","); UpdateBuilder.Append(" CPItemName=" + SysString.ToDBString(MasterEntity.CPItemName) + ","); UpdateBuilder.Append(" CPItemStd=" + SysString.ToDBString(MasterEntity.CPItemStd) + ","); UpdateBuilder.Append(" CPItemModel=" + SysString.ToDBString(MasterEntity.CPItemModel) + ","); UpdateBuilder.Append(" Machine=" + SysString.ToDBString(MasterEntity.Machine) + ","); UpdateBuilder.Append(" Needle=" + SysString.ToDBString(MasterEntity.Needle) + ","); UpdateBuilder.Append(" DtsAfterFinish=" + SysString.ToDBString(MasterEntity.DtsAfterFinish) + ","); UpdateBuilder.Append(" DtsPackMethod=" + SysString.ToDBString(MasterEntity.DtsPackMethod) + ","); if (MasterEntity.AddFee != 0) { UpdateBuilder.Append(" AddFee=" + SysString.ToDBString(MasterEntity.AddFee) + ","); } else { UpdateBuilder.Append(" AddFee=null,"); } if (MasterEntity.AddFee2 != 0) { UpdateBuilder.Append(" AddFee2=" + SysString.ToDBString(MasterEntity.AddFee2) + ","); } else { UpdateBuilder.Append(" AddFee2=null,"); } if (MasterEntity.AddFee3 != 0) { UpdateBuilder.Append(" AddFee3=" + SysString.ToDBString(MasterEntity.AddFee3) + ","); } else { UpdateBuilder.Append(" AddFee3=null,"); } if (MasterEntity.AddFee4 != 0) { UpdateBuilder.Append(" AddFee4=" + SysString.ToDBString(MasterEntity.AddFee4) + ","); } else { UpdateBuilder.Append(" AddFee4=null,"); } if (MasterEntity.AddFee5 != 0) { UpdateBuilder.Append(" AddFee5=" + SysString.ToDBString(MasterEntity.AddFee5) + ","); } else { UpdateBuilder.Append(" AddFee5=null,"); } UpdateBuilder.Append(" PUnit=" + SysString.ToDBString(MasterEntity.PUnit) + ","); UpdateBuilder.Append(" StyleNo=" + SysString.ToDBString(MasterEntity.StyleNo) + ","); UpdateBuilder.Append(" Batch=" + SysString.ToDBString(MasterEntity.Batch) + ","); UpdateBuilder.Append(" HandleStatus=" + SysString.ToDBString(MasterEntity.HandleStatus) + ","); if (MasterEntity.HandleStatusDate != SystemConfiguration.DateTimeDefaultValue) { UpdateBuilder.Append(" HandleStatusDate=" + SysString.ToDBString(MasterEntity.HandleStatusDate.ToString("yyyy-MM-dd HH:mm:ss")) + ","); } else { UpdateBuilder.Append(" HandleStatusDate=null,"); } UpdateBuilder.Append(" AllMWidth=" + SysString.ToDBString(MasterEntity.AllMWidth) + ","); if (MasterEntity.OrderQty != 0) { UpdateBuilder.Append(" OrderQty=" + SysString.ToDBString(MasterEntity.OrderQty) + ","); } else { UpdateBuilder.Append(" OrderQty=null,"); } UpdateBuilder.Append(" OrderUnit=" + SysString.ToDBString(MasterEntity.OrderUnit) + ","); UpdateBuilder.Append(" BCPItemCode=" + SysString.ToDBString(MasterEntity.BCPItemCode) + ","); UpdateBuilder.Append(" BCPItemStd=" + SysString.ToDBString(MasterEntity.BCPItemStd) + ","); UpdateBuilder.Append(" BCPItemName=" + SysString.ToDBString(MasterEntity.BCPItemName) + ","); UpdateBuilder.Append(" BCPItemModel=" + SysString.ToDBString(MasterEntity.BCPItemModel) + ","); if (MasterEntity.PieceWeight != 0) { UpdateBuilder.Append(" PieceWeight=" + SysString.ToDBString(MasterEntity.PieceWeight) + ","); } else { UpdateBuilder.Append(" PieceWeight=null,"); } UpdateBuilder.Append(" BCPColorNum=" + SysString.ToDBString(MasterEntity.BCPColorNum) + ","); UpdateBuilder.Append(" BCPColorName=" + SysString.ToDBString(MasterEntity.BCPColorName) + ","); UpdateBuilder.Append(" BCPMWidth=" + SysString.ToDBString(MasterEntity.BCPMWidth) + ","); UpdateBuilder.Append(" BCPMWeight=" + SysString.ToDBString(MasterEntity.BCPMWeight) + ","); if (MasterEntity.BoxQty != 0) { UpdateBuilder.Append(" BoxQty=" + SysString.ToDBString(MasterEntity.BoxQty) + ","); } else { UpdateBuilder.Append(" BoxQty=null,"); } if (MasterEntity.SetQty != 0) { UpdateBuilder.Append(" SetQty=" + SysString.ToDBString(MasterEntity.SetQty) + ","); } else { UpdateBuilder.Append(" SetQty=null,"); } if (MasterEntity.DozensQty != 0) { UpdateBuilder.Append(" DozensQty=" + SysString.ToDBString(MasterEntity.DozensQty) + ","); } else { UpdateBuilder.Append(" DozensQty=null,"); } UpdateBuilder.Append(" LoadFormNo=" + SysString.ToDBString(MasterEntity.LoadFormNo) + ","); UpdateBuilder.Append(" VOrderFormNo=" + SysString.ToDBString(MasterEntity.VOrderFormNo) + ","); if (MasterEntity.CPInQty != 0) { UpdateBuilder.Append(" CPInQty=" + SysString.ToDBString(MasterEntity.CPInQty) + ","); } else { UpdateBuilder.Append(" CPInQty=null,"); } if (MasterEntity.CPInDate != SystemConfiguration.DateTimeDefaultValue) { UpdateBuilder.Append(" CPInDate=" + SysString.ToDBString(MasterEntity.CPInDate.ToString("yyyy-MM-dd HH:mm:ss"))); } else { UpdateBuilder.Append(" CPInDate=null"); } UpdateBuilder.Append(" WHERE " + "ID=" + SysString.ToDBString(MasterEntity.ID)); //执行 int AffectedRows = 0; if (!this.sqlTransFlag) { AffectedRows = this.ExecuteNonQuery(UpdateBuilder.ToString()); } else { AffectedRows = sqlTrans.ExecuteNonQuery(UpdateBuilder.ToString()); } return(AffectedRows); } catch (BaseException E) { throw new BaseException(E.Message, E); } catch (Exception E) { throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBUpdate), E); } }
/// <summary> /// 新增 /// </summary> /// <param name="p_Entity">实体类</param> /// <returns>操作影响的记录行数</returns> public override int AddNew(BaseEntity p_Entity) { try { FabricProcessDts MasterEntity = (FabricProcessDts)p_Entity; if (MasterEntity.ID == 0) { return(0); } //新增主表数据 StringBuilder MasterField = new StringBuilder(); StringBuilder MasterValue = new StringBuilder(); MasterField.Append("INSERT INTO WO_FabricProcessDts("); MasterValue.Append(" VALUES("); MasterField.Append("ID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.ID) + ","); MasterField.Append("MainID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.MainID) + ","); MasterField.Append("Seq" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.Seq) + ","); MasterField.Append("ItemCode" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.ItemCode) + ","); MasterField.Append("GoodsCode" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.GoodsCode) + ","); MasterField.Append("ColorNum" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.ColorNum) + ","); MasterField.Append("ColorName" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.ColorName) + ","); MasterField.Append("MWidth" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.MWidth) + ","); MasterField.Append("MWeight" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.MWeight) + ","); MasterField.Append("WeightUnit" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.WeightUnit) + ","); MasterField.Append("ItemName" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.ItemName) + ","); MasterField.Append("VColorNum" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.VColorNum) + ","); MasterField.Append("VColorName" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.VColorName) + ","); MasterField.Append("VItemCode" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.VItemCode) + ","); MasterField.Append("Qty" + ","); if (MasterEntity.Qty != 0) { MasterValue.Append(SysString.ToDBString(MasterEntity.Qty) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("Unit" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.Unit) + ","); MasterField.Append("SingPrice" + ","); if (MasterEntity.SingPrice != 0) { MasterValue.Append(SysString.ToDBString(MasterEntity.SingPrice) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("Amount" + ","); if (MasterEntity.Amount != 0) { MasterValue.Append(SysString.ToDBString(MasterEntity.Amount) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("ReceivedDate" + ","); if (MasterEntity.ReceivedDate != SystemConfiguration.DateTimeDefaultValue) { MasterValue.Append(SysString.ToDBString(MasterEntity.ReceivedDate.ToString("yyyy-MM-dd HH:mm:ss")) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("ReceivedQty" + ","); if (MasterEntity.ReceivedQty != 0) { MasterValue.Append(SysString.ToDBString(MasterEntity.ReceivedQty) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("TotalRecQty" + ","); if (MasterEntity.TotalRecQty != 0) { MasterValue.Append(SysString.ToDBString(MasterEntity.TotalRecQty) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("RemainQty" + ","); if (MasterEntity.RemainQty != 0) { MasterValue.Append(SysString.ToDBString(MasterEntity.RemainQty) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("RemainRate" + ","); if (MasterEntity.RemainRate != 0) { MasterValue.Append(SysString.ToDBString(MasterEntity.RemainRate) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("DtsReqDate" + ","); if (MasterEntity.DtsReqDate != SystemConfiguration.DateTimeDefaultValue) { MasterValue.Append(SysString.ToDBString(MasterEntity.DtsReqDate.ToString("yyyy-MM-dd HH:mm:ss")) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("Remark" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.Remark) + ","); MasterField.Append("OrderPreStatusID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.OrderPreStatusID) + ","); MasterField.Append("OrderStatusID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.OrderStatusID) + ","); MasterField.Append("DtsSO" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.DtsSO) + ","); MasterField.Append("DVendorID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.DVendorID) + ","); MasterField.Append("NLQty" + ","); if (MasterEntity.NLQty != 0) { MasterValue.Append(SysString.ToDBString(MasterEntity.NLQty) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("NLFormDate" + ","); if (MasterEntity.NLFormDate != SystemConfiguration.DateTimeDefaultValue) { MasterValue.Append(SysString.ToDBString(MasterEntity.NLFormDate.ToString("yyyy-MM-dd HH:mm:ss")) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("InQty" + ","); if (MasterEntity.InQty != 0) { MasterValue.Append(SysString.ToDBString(MasterEntity.InQty) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("InFormDate" + ","); if (MasterEntity.InFormDate != SystemConfiguration.DateTimeDefaultValue) { MasterValue.Append(SysString.ToDBString(MasterEntity.InFormDate.ToString("yyyy-MM-dd HH:mm:ss")) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("OutQty" + ","); if (MasterEntity.OutQty != 0) { MasterValue.Append(SysString.ToDBString(MasterEntity.OutQty) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("OutFormDate" + ","); if (MasterEntity.OutFormDate != SystemConfiguration.DateTimeDefaultValue) { MasterValue.Append(SysString.ToDBString(MasterEntity.OutFormDate.ToString("yyyy-MM-dd HH:mm:ss")) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("PieceQty" + ","); if (MasterEntity.PieceQty != 0) { MasterValue.Append(SysString.ToDBString(MasterEntity.PieceQty) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("ItemStd" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.ItemStd) + ","); MasterField.Append("ItemModel" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.ItemModel) + ","); MasterField.Append("GreyFabItemCode" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.GreyFabItemCode) + ","); MasterField.Append("CalNum" + ","); if (MasterEntity.CalNum != 0) { MasterValue.Append(SysString.ToDBString(MasterEntity.CalNum) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("CalUnit" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.CalUnit) + ","); MasterField.Append("DtsRemark" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.DtsRemark) + ","); MasterField.Append("DesignNo" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.DesignNo) + ","); MasterField.Append("EditionOK" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.EditionOK) + ","); MasterField.Append("FreeStr1" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.FreeStr1) + ","); MasterField.Append("FreeStr2" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.FreeStr2) + ","); MasterField.Append("FreeStr3" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.FreeStr3) + ","); MasterField.Append("FreeStr4" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.FreeStr4) + ","); MasterField.Append("FreeStr5" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.FreeStr5) + ","); MasterField.Append("SL" + ","); if (MasterEntity.SL != 0) { MasterValue.Append(SysString.ToDBString(MasterEntity.SL) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("PBWeight" + ","); if (MasterEntity.PBWeight != 0) { MasterValue.Append(SysString.ToDBString(MasterEntity.PBWeight) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("CPItemCode" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.CPItemCode) + ","); MasterField.Append("CPItemName" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.CPItemName) + ","); MasterField.Append("CPItemStd" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.CPItemStd) + ","); MasterField.Append("CPItemModel" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.CPItemModel) + ","); MasterField.Append("Machine" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.Machine) + ","); MasterField.Append("Needle" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.Needle) + ","); MasterField.Append("DtsAfterFinish" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.DtsAfterFinish) + ","); MasterField.Append("DtsPackMethod" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.DtsPackMethod) + ","); MasterField.Append("AddFee" + ","); if (MasterEntity.AddFee != 0) { MasterValue.Append(SysString.ToDBString(MasterEntity.AddFee) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("AddFee2" + ","); if (MasterEntity.AddFee2 != 0) { MasterValue.Append(SysString.ToDBString(MasterEntity.AddFee2) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("AddFee3" + ","); if (MasterEntity.AddFee3 != 0) { MasterValue.Append(SysString.ToDBString(MasterEntity.AddFee3) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("AddFee4" + ","); if (MasterEntity.AddFee4 != 0) { MasterValue.Append(SysString.ToDBString(MasterEntity.AddFee4) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("AddFee5" + ","); if (MasterEntity.AddFee5 != 0) { MasterValue.Append(SysString.ToDBString(MasterEntity.AddFee5) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("PUnit" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.PUnit) + ","); MasterField.Append("StyleNo" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.StyleNo) + ","); MasterField.Append("Batch" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.Batch) + ","); MasterField.Append("HandleStatus" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.HandleStatus) + ","); MasterField.Append("HandleStatusDate" + ","); if (MasterEntity.HandleStatusDate != SystemConfiguration.DateTimeDefaultValue) { MasterValue.Append(SysString.ToDBString(MasterEntity.HandleStatusDate.ToString("yyyy-MM-dd HH:mm:ss")) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("AllMWidth" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.AllMWidth) + ","); MasterField.Append("OrderQty" + ","); if (MasterEntity.OrderQty != 0) { MasterValue.Append(SysString.ToDBString(MasterEntity.OrderQty) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("OrderUnit" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.OrderUnit) + ","); MasterField.Append("BCPItemCode" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.BCPItemCode) + ","); MasterField.Append("BCPItemStd" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.BCPItemStd) + ","); MasterField.Append("BCPItemName" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.BCPItemName) + ","); MasterField.Append("BCPItemModel" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.BCPItemModel) + ","); MasterField.Append("PieceWeight" + ","); if (MasterEntity.PieceWeight != 0) { MasterValue.Append(SysString.ToDBString(MasterEntity.PieceWeight) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("BCPColorNum" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.BCPColorNum) + ","); MasterField.Append("BCPColorName" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.BCPColorName) + ","); MasterField.Append("BCPMWidth" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.BCPMWidth) + ","); MasterField.Append("BCPMWeight" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.BCPMWeight) + ","); MasterField.Append("BoxQty" + ","); if (MasterEntity.BoxQty != 0) { MasterValue.Append(SysString.ToDBString(MasterEntity.BoxQty) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("SetQty" + ","); if (MasterEntity.SetQty != 0) { MasterValue.Append(SysString.ToDBString(MasterEntity.SetQty) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("DozensQty" + ","); if (MasterEntity.DozensQty != 0) { MasterValue.Append(SysString.ToDBString(MasterEntity.DozensQty) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("LoadFormNo" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.LoadFormNo) + ","); MasterField.Append("VOrderFormNo" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.VOrderFormNo) + ","); MasterField.Append("CPInQty" + ","); if (MasterEntity.CPInQty != 0) { MasterValue.Append(SysString.ToDBString(MasterEntity.CPInQty) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("CPInDate" + ")"); if (MasterEntity.CPInDate != SystemConfiguration.DateTimeDefaultValue) { MasterValue.Append(SysString.ToDBString(MasterEntity.CPInDate.ToString("yyyy-MM-dd HH:mm:ss")) + ")"); } else { MasterValue.Append("null)"); } //执行 int AffectedRows = 0; if (!this.sqlTransFlag) { AffectedRows = this.ExecuteNonQuery(MasterField.Append(MasterValue.ToString()).ToString()); } else { AffectedRows = sqlTrans.ExecuteNonQuery(MasterField.Append(MasterValue.ToString()).ToString()); } return(AffectedRows); } catch (BaseException E) { throw new BaseException(E.Message, E); } catch (Exception E) { throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBInsert), E); } }
/// <summary> /// 新增(传入事务处理) /// </summary> /// <param name="p_BE">要新增的实体</param> /// <param name="sqlTrans">事务类</param> public void RAdd(BaseEntity p_BE, BaseEntity[] p_BE2, BaseEntity[] p_BE3, IDBTransAccess sqlTrans) { try { this.CheckCorrect(p_BE); FabricProcess entity = (FabricProcess)p_BE; this.RAdd(entity, sqlTrans); //string sql = "SELECT FormNo FROM WO_FabricProcess WHERE FormNo=" + SysString.ToDBString(entity.FormNo); //DataTable dt = sqlTrans.Fill(sql); //if (dt.Rows.Count > 0) //{ // throw new BaseException("染布加工单号已存在,请重新生成"); //} //FabricProcessCtl control = new FabricProcessCtl(sqlTrans); //entity.ID = (int)EntityIDTable.GetID((long)SysEntity.WO_FabricProcess, sqlTrans); //control.AddNew(entity); for (int i = 0; i < p_BE2.Length; i++) { FabricProcessDtsRule rule = new FabricProcessDtsRule(); FabricProcessDts entityDts = (FabricProcessDts)p_BE2[i]; entityDts.MainID = entity.ID; entityDts.Seq = i + 1; rule.RAdd(entityDts, sqlTrans); } if (p_BE3 != null) { for (int i = 0; i < p_BE3.Length; i++) { FabricProcessItemDtsRule rule = new FabricProcessItemDtsRule(); FabricProcessItemDts entityItemfac = (FabricProcessItemDts)p_BE3[i]; entityItemfac.MainID = entity.ID; entityItemfac.Seq = i + 1; rule.RAdd(entityItemfac, sqlTrans); } } //FormNoControlRule frule = new FormNoControlRule(); //if (entity.ProcessTypeID == (int)EnumProcessType.染整加工单) //{ // frule.RAddSort((int)FormNoControlEnum.染布加工单号,sqlTrans); //} //if (entity.ProcessTypeID == (int)EnumProcessType.印花加工单) //{ // frule.RAddSort((int)FormNoControlEnum.印花加工单号, sqlTrans); //} //if (entity.ProcessTypeID == (int)EnumProcessType.织造加工单) //{ // frule.RAddSort((int)FormNoControlEnum.织造加工单号, sqlTrans); //} //if (entity.ProcessTypeID == (int)EnumProcessType.其他加工单) //{ // frule.RAddSort((int)FormNoControlEnum.其他加工单号, sqlTrans); //} } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }