You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
using System; using System.Collections.Generic; using System.Linq; using System.Text; using ICSSoft.Frame.Data.Entity; using ICSSoft.Base.Config.DBHelper; using System.Data; using ICSSoft.Base.Config.AppConfig;
namespace ICSSoft.Frame.Data.DAL { public class ICSASNIQCDETAILDAL { public static void AddAndEdit(List<ICSASNIQCDETAIL> mandayInfoList, string dsconn) {
FramDataContext db = new FramDataContext(dsconn); db.Connection.Open(); db.Transaction = db.Connection.BeginTransaction(); try { foreach (ICSASNIQCDETAIL mandayInfo in mandayInfoList) {
///jia pan duan
bool isNew = false; var entity = db.ICSASNIQCDETAIL.SingleOrDefault(a => a.ID == mandayInfo.ID); if (entity == null) { isNew = true; entity = new ICSASNIQCDETAIL(); entity.ID = mandayInfo.ID; } entity.IQCID = mandayInfo.IQCID; entity.IQCNO = mandayInfo.IQCNO; entity.STNO = mandayInfo.STNO; entity.STLINE = mandayInfo.STLINE; entity.ITEMCODE = mandayInfo.ITEMCODE; //采购订单号
entity.ORDERNO =mandayInfo.ORDERNO; //采购订单行
entity.ORDERLINE =mandayInfo.ORDERLINE; entity.STDSTATUS = mandayInfo.STDSTATUS; entity.RECEIVEQTY = mandayInfo.RECEIVEQTY; entity.CHECKSTATUS = mandayInfo.CHECKSTATUS; entity.UNIT = mandayInfo.UNIT; //采购备注
entity.PurchaseMEMO = mandayInfo.PurchaseMEMO; entity.MEMO = mandayInfo.MEMO; entity.MEMOEX = mandayInfo.MEMOEX; entity.SAMPLEQTY = mandayInfo.SAMPLEQTY; entity.NGQTY = mandayInfo.NGQTY; entity.PIC = mandayInfo.PIC; entity.ACTION =mandayInfo.ACTION; entity.INSType = mandayInfo.INSType; entity.DINSPDATE = mandayInfo.DINSPDATE; entity.DINSPECTOR = mandayInfo.DINSPECTOR; entity.ATTRIBUTE = mandayInfo.ATTRIBUTE; entity.Type = mandayInfo.Type; entity.StorageID = mandayInfo.StorageID; entity.concessionStatus = mandayInfo.concessionStatus; entity.concessionQTY = mandayInfo.concessionQTY; entity.concessionNO = mandayInfo.concessionNO; entity.concessionMemo = mandayInfo.concessionMemo; entity.WORKPOINT = mandayInfo.WORKPOINT; entity.MUSER = mandayInfo.MUSER; entity.MUSERNAME = mandayInfo.MUSERNAME; entity.MTIME = mandayInfo.MTIME;
entity.isSample = mandayInfo.isSample; entity.AQL = mandayInfo.AQL; entity.CheckGroup = mandayInfo.CheckGroup; entity.TSErrorCodeGroup = mandayInfo.TSErrorCodeGroup; entity.TSErrorCode = mandayInfo.TSErrorCode; entity.IQCDepartment = mandayInfo.IQCDepartment; if (isNew) db.ICSASNIQCDETAIL.InsertOnSubmit(entity); db.SubmitChanges(); }
db.SubmitChanges(); db.Transaction.Commit(); } catch (Exception ex) { db.Transaction.Rollback(); throw ex; } }
//public static void deleteInfo(string dsconn, List<string> codeList)
//{
// FramDataContext db = new FramDataContext(dsconn);
// db.Connection.Open();
// db.Transaction = db.Connection.BeginTransaction();
// try
// {
// var lines = db.ICSASNIQCDETAIL.Where(a => codeList.Contains(a.ID));
// db.ICSASNIQCDETAIL.DeleteAllOnSubmit(lines);
// db.SubmitChanges();
// db.Transaction.Commit();
// }
// catch (Exception ex)
// {
// db.Transaction.Rollback();
// throw ex;
// }
//}
public static int SelectCount(string iqcno) { string sql = @"select STDSTATUS
from dbo.ICSASNIQCDETAIL where IQCNO='" + iqcno + "' and STDSTATUS='待检' and WorkPoint='" + AppConfig.WorkPointCode + "'";
sql = string.Format(sql); DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql).Tables[0]; int str = dt.Rows.Count; return str; } //修改入库单子表状态
public static void UpdateICSINVReceiptDetailState(string checkstatus,double qualifyqty,string node) { string str = "update ICSINVReceiptDetail set IQCStatus='" + checkstatus + "' from ICSASNIQCDETAIL as a,ICSINVReceiptDetail as b " + "where a.STNO=b.ReceiptNO and a.STLINE=b.ReceiptLine and a.IQCNO='"+node+"' and a.WorkPoint='" + AppConfig.WorkPointCode + "' and b.WorkPoint='" + AppConfig.WorkPointCode + "' "; string s= " update ICSINVReceiptDetail set QualifyQTY='" + qualifyqty + "' from ICSASNIQCDETAIL as a,ICSINVReceiptDetail as b " + "where a.STNO=b.ReceiptNO and a.STLINE=b.ReceiptLine and a.IQCNO='" + node + "' and a.WorkPoint='" + AppConfig.WorkPointCode + "' and b.WorkPoint='" + AppConfig.WorkPointCode + "'"; DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, str); DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, s); } public static void Set(string iqcno) { string sql = @"update dbo.ICSASNIQC
set STATUS='已检未入库' where IQCNO='" + iqcno + "' and WorkPoint='" + AppConfig.WorkPointCode + "'";
sql = string.Format(sql); DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql); return; } } }
|